Log of the #nice channel on irc.freenode.net

Using timezone: Central European Time
* arjanb leaves00:45
* Arafangion joins01:56
Four users my ass! :)01:57
I am having trouble understanding what is so good about nice - it appears to be just a 'better java', catching more errors at compile time?02:00
<-- just read that nice supports multi-methods!
<Arafangion>Doesn't have many people here!03:41
Gummi_log: Are you a logging bot?03:47
* bonniot joins09:06
<bonniot>what brings you here?09:22
<Arafangion>Just saw the language :)09:37
Haven't written anything in it, nor downloaded, I just read about many differnet languages - it's interesting :)
<bonniot>ok. don't hesitate if you have questions or suggestions09:47
<Arafangion>How new is the language? :)09:58
<bonniot>started about 5 years ago, but first it was more of a prototype09:59
<Arafangion>Why was it kept so similar to Java?10:00
Other languages I know are C#, Python (I really, really like Python), and I've read into Lisp, Ruby, Io, and others.10:01
<bonniot>for the back-end, it's practical to use the JVM, and to have access to the java libs
for the syntax, the idea is to only change those aspects where we can bring a real benefit10:02
so it's easier to learn from a Java background
i think that strategy is working, in that more people are trying the language, and using it in real projects, sometimes mixed with Java10:03
<Arafangion>I get annoyed with (stock) Java because it takes so much code to do simple things, compared to some other languages (in particular python)
Nice is aiming at being more expressive than Java ;-)10:04
anonymous functions, tuples, let, ... help you here
multi-methods too, rather than instanceof or visitors10:05
<Arafangion>What I really like about Python is that type-checking is not enforced, but you can still explicitly do it if you want.
<bonniot>how do you enforce it if you want?
at compile time?
<Arafangion>At runtime.
<bonniot>ah, ok10:06
<Arafangion>It's the only possible way in Python :)
<bonniot>it's even mandatory at runtime, no?
<Arafangion>Typechecking? No, infact it's loudly discouraged.
Sometimes you need it, though.
<bonniot>i mean, the runtime will eventually detect problems, not corrupt memory or something like that, right?10:07
detect missing methods
<Arafangion>It'll produce an exception if the attribute does not exist.10:08
you should read Bryn's article about dynamic vs static typing, one sec10:09
<Arafangion>However, a very nice feature of how python does it is that the method that is executed is the one that belongs to the object, not the class :)
i would say the basic point is: static typing is really helpful to detect bugs and model/refactor the program. only it's too restrictive in poor systems like C#/Java, making some people to prefer dynamic typing instead. but with a richer type system, you get the best of both worlds10:14
<Arafangion>I must say I extensively test my apps, but I do it in all my languages.
I am considering learning the CLOS.
I really like the idea of Haskell, though.10:15
<bonniot>you're right. testing is very important
<Arafangion>(Haven't learnt Monads, though)
<bonniot>you still need to do it in Nice ;-)
we were just discussing making nicec start the unit tests automatically ;-)10:16
<Arafangion>What really p*ss'ed me off lately was C#.
<bonniot>as an OO/multiple-dispatch language, CLOS is a bit outdated I think. better learn Nice (objectively ;-)10:17
<Arafangion>While (imho) it is better than Java in some ways, I hated that I couldn't do something like the following:
<bonniot>oth, Haskell is really different, so it can be interesting to know it too
<Arafangion>class E(D) { public string C = "eg";}10:18
Where C is also defined in D.
Now, if I have an object of type D, calling D.C should give me "eg", and not what it is defined as in D!
(In other words, inheritance and overloading and all that stuff works differently on attributes than to methods)10:19
<bonniot>in Nice you can do:
class E extends D { override String C = "eg"; }10:20
<Arafangion>That's exactly what I did in C#, except the C attribute, if queried, still has the value that D assigned!
<bonniot>so there is only one field C, it just has a different (default) value in E
that seems brain dead!10:21
<Arafangion>C# inherits alot of C++, but removes the syntax that makes it obvious that a different behaviour might be used.
Makes me wish I already knew C++!10:22
* Arafangion learnt QBasic, C, Python, C (properly), Python (Properly), Java (sigh, not as nice as Python), C# (Damn you VS.NET!!)10:23
<bonniot>are you stuck on .net?
For one more day (Exam tomorrow morning)
If .NET had a portable API, it'd be quite decent, actually.
yeah, it's a stange mix of standardized core and win-specific libs10:31
<Arafangion>It boggles my mind why either Qt or wx isn't more established.10:33
* ArtemGr joins
* Arafangion wants to implement his own Lisp dialect, just for fun :)10:35
<bonniot>ah, a classic!
<bonniot>reimplementing lisp10:37
<Arafangion>Cant be that hard.
<bonniot>yeah. a few lines of lisp ;-)10:38
<Arafangion>Indeed. I plan on implementing it in C/C++, though.
<Arafangion>So that I have access to libraries :)10:39
<bonniot>interesting: http://wx4j.sourceforge.net/10:42
does wx has a nice API?
i mean clean, practical, not "Nice" ;-)
<Arafangion>I don't know how to answer that question :)
It's 12 years old.
And it's extremely portable, using native widgets whenever possible.10:43
At one stage there was a port to Qt, and even DOS>
Having said that, imho it's a practical API, and most people say it's somewhat similar to the windows api.
Swing is much cleaner, but it felt far too 'engineered'. Had to explicitly make sizers, and a panel, and add a sizer to that if you wanted to nest, for example.10:44
In wx, just add the damn sizer and you've nested it!
It also has a very powerful event-table system.10:46
C# is strange.10:52
<ArtemGr>what about curses port? : ) i saw curses AWT implementation somewhere, by the way.10:53
<Arafangion>Why would you still use curses?
<ArtemGr>to run applications under telnet (ssh)10:55
<Arafangion>Sometimes it's warranted, but not usually.
<Arafangion>In that situation, why would you use Java?10:59
<ArtemGr>i prefer Nice
<Arafangion>(That is, Java and a VM)
<ArtemGr>in fact, i generate our tinydns rules from a Nice script11:00
* Arafangion would've used python for that sort of scripting!11:01
* Arafangion wonders if it is possible to re-implement python on top of lisp.11:06
I find Ruby particuarly interesting.11:21
<ArtemGr>does it have functional features, like closures?11:24
<Arafangion>If nothing else, it has closures :)
It is a frightenly featureful language. It decends from Perl and Python.
<ArtemGr>by the way, i thought about regular expressions in Java and Nice recently. What languages like C++ and Java lacks is ability to say /\w/ instead of "\\w" - doubleslashing makes regular expressions much less readable. Perhaps we can add a special string operator in addition to the ", where slash must not be escaped...11:27
<Arafangion>Python uses "raw strings".11:28
In which the string is prefixed by r, and all \'s become literal.
For example, instead of "\\w", I'd just write r"\w"
(And likewise for u"blah" for unicode strings, though imho, everything should be unicode)
<ArtemGr>yeah, we can take python approach to strings, or we can define /\w/ to be inlined into nice.lang.fun.regex( "\\w" ) ...11:30
or both
<Arafangion>I feel the python approach is more readable.11:31
<ArtemGr>Inlining /\w/ into a method call allow us to cache regexp's by default, which Perl and Jakarta-ORO do, but not java.util.regex11:33
<Arafangion>Infact, if it's possible, you could define various prefixes, such that the r-prefix is part of nice.lang.regex, and importing that provides the r prefix, additionally, for namespace issues, you could do regex.r"blah"
Actually scrap that.11:34
Python likes you to explicitly compile the regexp.
(imho, parsing is a much better solution)
<ArtemGr>well, something like r"\w" is what is really required, and regexp caching is not.11:38
<Arafangion>r"\w" is really nice, in particular in conjunction with: this.path = r"C:\My Documents\My Pictures\Arafangion.jpg" :)11:39
Hello? :)11:45
<Arafangion>What are you working on right now? regexp?
* ArtemGr hopes to have a spare time for Nice someday. : j11:46
* arjanb joins12:35
<ArtemGr>daniel, can we print a location for this error?12:52
Exception in thread "Thread-14" mlsub.typing.InternalError: Simplifying ill-formed polytype: <V, V0, K0, K | ru.webcrm.base.Component <: ru.webcrm.modapi.Data, V <: ?V0, K <: K0, java.lang.String <: K0, nice.lang.Map<?, ?> <: nice.lang.Map<K, V>> (nice.lang.Map<K, V>, K0)
<bonniot>well, it's a bug, not an error...12:53
something with wildcards again it seems12:54
I think it's easy to recover from this failure, if you want to work around it12:56
and it should still be fixed
do you want the workaround? can you make a testcase?13:06
<ArtemGr>i can't repeat the problem with clean Nice code. the problem is simple: get an untyped Map from a Java class, and invoke the #get method on this map13:07
let context = component.getContext(); context.get( "foo" );13:08
Map<CharSequence,Object> getContext( ru.webcrm.base.Component ) = native Map ru.webcrm.base.Component.getContext();
fixes the problem
have the test case13:13
class Foo { Map<?,?> getMap() = cast( null ); }
let ctx = new Foo().getMap(); ctx.get( "bar" );
that's it
<bonniot>ok, reproduced13:14
you wouldn't do much without a retyping, btw. or you use cast instead?
<ArtemGr>no, context.cast().get( "foo" ); produces something like13:16
Ambiguity for symbol get. Possibilities are :
java.lang.String get(ru.webcrm.base.cmsIface.Operator, ?java.lang.CharSequence)
Object get(org.apache.velocity.context.Context, ?java.lang.String)
<T, V> V get(java.lang.reflect.Field,T)
i will use retyping, it's better to have correct typing for that Map anyway13:17
otherwise, cast the result of the get, not the map
but reptying is indeed better style13:18
<ArtemGr>"otherwise, cast the result of the get, not the map" - no, this doesn't seem to help
<bonniot>note that the ambiguity is normal: after the cast, there is no indication what the type is, so any get method would be correct
<bonniot>why, what do you get?
<ArtemGr>the original problem had cast already:
let context = component.getContext();
let ?Menu_001 menu = cast( context.get( "Menu" ) );
i removed the cast for clarity. it doesn't help to solve the InternalError
<bonniot>oh yes, this is unrelated13:20
since the cast comes later
<Arafangion>Sorry, a Java question. See I have some "practice questiosn" for my exam, and my lecturer has classes with two methods of the same name in them!13:22
I thought that was disallowed - the two methods differ only that by the fact one of them is static, and the other is public (both accept no arguments, etc)
Damn, this is C#13:23
<bonniot>ArtemGr: CIA seems to be dormant, but I commited a fix for your bug20:35
<bonniot>each iteration is straightening up a bit more the wildcards implementation...20:40
bye, see you later20:41
* bonniot leaves
* ArtemGr leaves21:58
* arjanb leaves23:09