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

Using timezone: Central European Time
* markha leaves00:53
* bonniot joins12:20
<DRMacIver>Hm. Now how on earth does that work?12:53
new int[10] initialises an array filled with zeroes12:54
But new String[10] gives an error because it would be an array of nulls.
(And thus should be ?String[10] I suppose)
* |kshinji| joins13:07
Hello, is this a chanell about nice programming language?13:08
If yes, i have a problem. I need to convert JAVA program into NICE program. Anyone could help me?
Program has only several lines, it's very simple alghoritm, that rewrites standart input to standart output, until it receives 42.13:09
<DRMacIver>It is a channel aboutN
About Nice
What difficulty are you having in converting it?13:10
<|kshinji|>Well, i am complete noob to both Java and Nice.13:11
And i have just one, big problem. I can't do it myself. :)
<DRMacIver>Learning both at once might be considered inadvisable. :) There are enough fundamental differences that you'll get yourself really confused.
Why don't you pastebin your java code and I'll take a look.13:12
<|kshinji|>I am forced to do so, unfortunately.
ok, i'll do so.
I don't want someone else to do my job, however i am stuck. The errors i am receiving does not help me in any way.13:13
<DRMacIver>Hm. Is the intended to be Nice or Java? :) I'm not sure it will work as either.
One second.
<|kshinji|>it was working code in Java, however i removed 'static' keyword, and tried changing java.Integer into nice.int13:14
Well first of all, Nice doesn't put the main method on a class
It's a package method.
Nice has a much broader granularity than Java does and things you'd expect to group by class are grouped by package in Nice.13:15
You're also missing a package declaration. This is ok in Java, but not ok in Nice.
<|kshinji|>What's packagae?13:16
<DRMacIver>It's basically a way of organising your code
You can think of it as analagous to a directory
In Java a package is just a collection of classes. In Nice it also contains method declarations, etc. as things don't have to reside in a class.13:17
<DRMacIver>Now there are several problems with the way you're handling ints.
Firstly, "int a;" is not a valid declaration.
The reason is that this will result in a being null.
(Well, undeclared, but the two are similar)13:21
And Nice references are non nullable by default
<|kshinji|>int a =0; ?
Or you could declare it as nullable by ?int a = 0;
But this isn't a great idea here.13:22
The next problem is that new int(aString) is not valid.
Actually I don't think nice.lang.int has any constructors exposed.
<|kshinji|>So i need some other way to make integer from strings i get from SIDIN.
* DRMacIver just needs to remember what methods int exposeds for parsing strings.
You can probably just use the standard valueOf methods actually.13:27
<|kshinji|>wait, how does it work?13:28
int = valueOf( str ) ?13:29
<DRMacIver>Just trying to figure this out now. One second...13:31
(Sorry, slightly embarassed that I don't know how to do this. :) )
<|kshinji|>what should i say then? :P13:32
<DRMacIver>I'll let you knwo when I've figured it out. :)13:34
<|kshinji|>ok, thx :)
<DRMacIver>Argh. I swear that was the first thing I tried and it didn't work.13:42
<|kshinji|>uuu :/
<DRMacIver>|kshinji|: It seems Nice automatically converts from the various java integer representations. So int a = Integer.parseInt("1"); will give you a = 1, etc.13:43
Note that the way your code is written this will throw an exception if someone enters a non numeric value.13:44
<|kshinji|>ok, but i am ensured of valid input13:45
Ok, so i have questions.13:47
import java.io.* is valid?
(But importing a specific class from java.io is not)
<|kshinji|>decaring class Main{} is valid?13:52
<DRMacIver>Sure, but you don't need it.
<|kshinji|>i can declare method main outside of any class or what?13:56
Nice methods can be declared anywhere.
<|kshinji|>That's nice. :)
<DRMacIver>But note that there's a slight syntactic difference in doing so.
Nice considers doStuff(foo) and foo.doStuff() to be the same thing.13:59
If you're making a declaration inside a class then you're implicitly defining the first argument as 'this'
hey, my program got accepted :)14:00
<DRMacIver>i.e. suppose I define a toString() method in my class Foo. What I'm really doing is defining a function toString(Foo foo), but when defining it in the class I'm implicitly calling it on 'this'.
<|kshinji|>If you want to know, i am taking part in contest to write simple program in as many as possible languages. :)14:01
<DRMacIver>The reason for this slight weirdness is that because of the way Nice works, methods are more naturally written in the doStuff(foo) form. The .doStuff() is reallly for backwards compatability with Java syntax.
At least I think that's the reason. :)
<DRMacIver>bonniot can correct me if I'm wrong.
(On account of he's the evil genius responsible for the language. ;) )
<|kshinji|>oh :)14:02
<bonniot>DRMacIver, you're right (about the method syntax ;-))
<DRMacIver>Indeed although I'm very impressed by how well it works, I'm starting to think that the java like syntax is more misleading than anything else. :) Thinking of Nice as sortof like Java appears to cause more confusion than an unfamiliar syntax would.14:06
On the other hand, maybe this way has marketing advantages. Get 'em hooked before they realise what they've let themselves in for. ;)
<|kshinji|>Hail to C++14:07
* |kshinji| is going for Nemerle next... i am gonna win the contest.
<DRMacIver>markha is the person to talk to about Nemerle, but he's not around at the moment. :)14:10
* ArtemGr joins14:11
<DRMacIver>bonniot: Hm. Query. I've given an object a field of type S -> T. When I come to try and invoke this on something of value S it complains at me that this is a field.14:12
What am I doing wrong? :)14:13
Hmm. If I move the declaration inside the class it starts working.14:14
* bonniot leaves14:29
* bonniot joins
<kshinji>Anyone here knows nemerle?15:14
<DRMacIver>We have a semi-regular who does, but he's not around.15:15
* DRMacIver doesn't really do much .NET
<kshinji>you know, that's for the contest. I even don't know what's this .NET :)
<DRMacIver>.NET is Microsoft's multilanguage framework and virtual machine. Nemerle is designed to run on .NET15:18
* CIA-19 leaves15:40
<DRMacIver>(And if you don't have the .NET framework installed you won't be able to compile and run Nemerle code)15:41
* CIA-2 joins
<DRMacIver>Wow. I have *no* idea what this compiler error means. :)15:45
<kshinji>which error?
http://eugeneciurana.com/pastebin/pastebin.php?show=1146 is the code15:47
It's a problem with nullness inference.
Despite having set 'value' to a non-null value on the previous line, the compiler still thinks it might be null.15:49
So it won't allow me to use it where it requires a T rather than a ?T
<ArtemGr>it might be that nullness inference information isn't propagated far enough in the compiler15:51
<DRMacIver>How do you mean?15:52
<ArtemGr>nullness inference propagation in the Nice compiler was partly improved lately as a hack, by a people who didn't truly understand what he does with the compiler (me); what i mean is that nullness inference in Nice have it's constrains, it isn't complete. in this case, however, the error might mean just that Nice wasn't smart enough to match the type of the HashMap with the argument it got. i, personally, don't think we have a right to infet more from this com15:59
<DRMacIver>You got cut off after 'infet more from this com'16:00
<bonniot>isn't it just that when you do get on a hashtable, the result can always be null because the key might be absent?16:01
<ArtemGr>it was: i, personally, don't think we have a right to infer more from this compiler message...
<DRMacIver>I'm not inferring much from the compiler message at all. I'm inferring from the fact that when I add a not null assertion the problem goes away. :)16:02
bonniot: Yes. The problem occurs on putting something in rather than taking it out.
bonniot: It's actually the SoftReference it's complaining about getting a null value, not the HashMap16:03
<bonniot>yes, this looks like a bug16:07
please open a report for it
<DRMacIver>ok. How do I do that? :)
Ah, I see16:08
Ok. Bug submitted.16:11
<DRMacIver>Nice doesn't have the same problem Java does with instantiating generic arrays does it?16:12
The compiler seems to be objecting to the following line: ?T[] references = new ?T[cacheSize];
Here's the full code: http://eugeneciurana.com/pastebin/pastebin.php?show=114816:17
The error is Encounter "?". Was expecting: <IDENT> ...16:18
<bonniot>new T[...]16:21
<DRMacIver>Are array entries automatically nullable then?16:23
Because my experiments earlier suggested otherwise
Hm. Ok so I now have ?T[] references = new T[cacheSize]; and this appears to work.16:25
But I don't understand why...
<bonniot>yes, since there are no values in the array after a new, the type has to be nullable16:29
there are some functions in nice.lang to create arrays with non-null values
I thought I ran an experiment earlier which suggested this wasn't the case, but maybe I screwed up.
<kshinji>c u, thanks again for help :)16:31
* kshinji leaves
<bonniot>it's just different for primitive types
* DRMacIver is creating a thoroughly overengineered and silly toy project / library for cacheing calculations16:33
It mainly exists for the dual purposes of playing around with Nice and playing around with soft references and garbage collection.16:34
Hence trying out some slightly odd things. :)
<bonniot>sounds cool16:36
<DRMacIver>Hm. How (if at all) does partial evaluation work?16:37
I have a method foo(Bar bar, Baz baz) and a Bar, and I want to return the method baz -> foo(myBar, baz) 16:38
Is there a nice syntax for this or do I just have to use the anonymous methods?
<bonniot>no special syntax for it atm. you must use an anon method16:51
Oops. The code I submitted in the bug report was actually wrong. :)16:53
(It's still a bug, and it still demonstrates this accurately, it just doesn't do what it's meant to even when the bug is fixed)
<bonniot>ok. if you can simplify the bug report, by all means do...16:57
like ideally it should not depend on external classes like HashMap
<DRMacIver>I'm going to have to disappear now. I'll try and come up with a better piece of sample code later.16:59
<bonniot>ok, no problem
this one is quite short already, but i'm sure it can be improved ;-)
<DRMacIver>I suspect it should be fairly trivial to do so.17:00
* DRMacIver will do it when he gets back
* arjanb leaves17:14
* arjanb joins17:15
* ArtemGr leaves17:39
* bonniot leaves21:07
<DRMacIver>Intriguingly, the problem doesn't appear as easy to replicate as I'd believed.21:51
The two test cases I thought would exhibit it don't.21:52