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

Using timezone: Central European Time
* CIA-1 leaves11:25
* CIA-6 joins11:34
* arjanb joins12:31
* cm_ joins14:24
Hi, where is class List<T> defined? Is this a hack or is it possible to parameterize an existing class?14:34
<arjanb>it's possible to retype java classes/methods to use type parameters14:36
most retypings are in http://cvs.sourceforge.net/viewcvs.py/nice/Nice/stdlib/nice/lang/java.nice?rev=1.57&sortby=date&view=markup14:37
do you need to parameterize some other classes?14:51
<cm_>I have a class with a method that returns an iterator. I want to parameterize that iterator. (or actually the method)14:53
<arjanb>what's the signature of that method?14:55
<cm_>Something like this? <T> Iterator<T> iterator(MyClass<T>) = native Iterator MyClass.iterator();
The signature is: java.util.Iterator iterator();
<arjanb>looks good
<cm_>Thanks! Any pattern to organise such things? Adding a package x.y.z.nice?14:58
<arjanb>putting it in a separate package is a good idea14:59
<cm_>As nice is combatible with the Java 1.5 generic classes is this only a temporary solution anyway I suppose.15:01
<arjanb>well not completely compatible but when 1.5 is out we will try to convert the java 1.5 generic types to the Nice types15:04
and some retyping will be needed because of option types15:07
<cm_>Ok, is anyone working actively on the eclipse plug-in?15:18
<arjanb>no15:22
who started it is now too busy with his job
* CIA-6 leaves15:31
* CIA-6 joins
<cm_>Small suggestion to the stdlib: <T> List<T> tabulate(int n, int -> T func) {17:12
List<T> res= new LinkedList();
for (int i=0; i<n; i++) {
res.add(func(i));
}
return res;
}
<arjanb>there is such a function for arrays18:16
problem is what kind of list to use
<cm_>Ok, what is it called?18:53
I have another question. How do I retype a "class Myclass implements Iterator" such that "Object next()" is of a specific type?19:03
<arjanb>class MyClass<T> implements Iterator<T> = native package.MyClass;19:05
<T, U | U <: T> U[] fill(T[] array, int->U value)19:10
<cm_>But then I have to retype the constructor as well. Why doesn't this work: MyType next(MyClass)= native Object MyClass.next() work?19:11
Thanks! I have this problem with class MyClass impl. Iterator: "MyClass has 1 type parameter". Can I specify the type parameter?19:14
<arjanb>then you're telling nicec it's another method than next() of Iterator
do you get the error at the next method?19:15
<cm_>Just by writing: MyClass class. The problem is that a want to implement Iterator with a specific type without having type parameters19:16
MyClass<MyType> x works but that doesn't make sense19:17
<arjanb>what happens if you write: class MyClass implements Iterator<MyType> = native package.MyClass;
<cm_>Class misc.PslParser cannot implement nice.lang.Iterator: they do not have the same number or kind of type parameters19:20
misc.PslParser == MyClass
<arjanb>hmmm that doesn't work in nicec 0.9.819:22
<cm_>Aha, is the cvs version stable?19:24
<arjanb>yes except for the new features19:25
<cm_>Is it possible to compile the cvs version with 0.9.8? 19:26
... nice.lang: parsing
nice.tools.locator: parsing
nice.tools.repository: parsing
~/cvs/nice/Nice/stdlib/nice/lang/java.nice: line 43, column 1:
Class has 1 type parameter
~/cvs/nice/Nice/stdlib/nice/lang/java.nice: line 44, column 19:
Class has 1 type parameter
~/cvs/nice/Nice/stdlib/nice/lang/java.nice: line 45, column 21:
Class has 1 type parameter
<arjanb>i'm not sure, you might need to download the development version: nice.sf.net\nice.jar19:27
<cm_>That worked but I still get the same compiler error: "PslParser has 1 type parameter"19:55
<arjanb>it looks like it isn't implemented for retypings yet19:57
i guess you should MyClass<MyType> or don't implement iterator until daniel implements this20:03
<cm_>Ok, thanks for your help! Do you know if it going to be impl. in the near future?20:06
<arjanb>i don't know but you could mail daniel with your problem to boost priority20:09
cm_: do you have other questions or remarks?20:42
we would like to hear about minor issues with language which most people don't bother to ask about20:44
<cm_>I would like to see a more exhaustive pattern matching mechanism but I it might be out of scope (reimpl. Haskell?)20:53
<arjanb>do you have an example?20:54
<cm_>Simple example:20:59
sumlist []= 0
sumlist (x:xs)= x + sumlist(xs)
I this case it is possible to match on the constructor and break apart the list
The "constructor" is ":"21:00
But I don't is possible to do it the Haskell way. You could define a list as:21:01
data [a] = [] | a : [a]
This is a hack in languages like ocaml and Standard ML but not in haskell21:03
<arjanb>abstract class MyList<T> {}21:05
class Nil<T> extends MyList<T> {}
class Cons<T> extends MyList<T>
{
T head;
MyList<T> tail;
}
int sum(MyList<int> list);
sum(Nil list) = 0;
sum(Cons list) = list.head + sum(list.tail);
this works atm in Nice
only breaking apart the constructor isn't possible (yet?)
<cm_>I guess the [] notation part of the syntax? (eg [1,2,3,]21:07
I would like a language like Haskell but without monads as I never could argue people that I work with that it is a good idea21:08
And the Java interoperability is very nice21:09
I think Nice, as it is to day, is far more nice to work with if you compare it to Java21:10
<arjanb>i have no idea how far Nice will move in the direction of pure functional language21:11
<cm_>I think you have to be pragmatic in order to attract "ordinary" programmers21:12
<arjanb>i think Nice (when finished) can make more programmers try functional programming by offering a pragmatic step between21:15
<cm_>I would like a plug-in to eclipse but that is a huge project as suppose. 21:17
<arjanb>yes we don't have the manpower for that21:18
<cm_>The import semantics seems to somewhat confusing. I couldn't import a specific class with import x.y.z.MyClass.21:19
<arjanb>yes that's because methods don't belong to classes in Nice so what would importing a class mean21:22
<cm_>So it isn't possible to import a single java-class then21:24
<arjanb>yes
<cm_>Why not define a java-import and a nice-import or something like that21:25
<arjanb>well that's a topic of discussion, we need a more fine grained import than packages only but not sure how21:27
for Nice it makes sense to import specific methods21:33
<cm_>Yes, and in order to prevent name clashes21:35
Are you working on Nice on your spare time?
<arjanb>yes21:36
<cm_>What about continuations? Is it feasible with the JVM?21:42
<arjanb>not impossible but ...21:44
the only working implementation i know of uses runtime classloading trickery21:46
<cm_>Sun might respond as it is impl. in .NET 2.021:47
Something like javadoc would certainly make it more simple to get started.
<arjanb>continuations in .NET ? i have heard of that before21:48
have never21:49
<cm_>You could impl. foreach as: public object foreach() {21:51
for (int i = 0; i < count; i++) yield elements[i];
}
"yield" is the magic
<arjanb>that's just a generator which is not hard to do in the jvm21:54
<cm_>So it is possible to save the context/closure?21:57
<arjanb>Nice has generators in library form in nice.functional and i'm considering to make it build-in after 1.021:58
yes using a class for each generator with fiels containing the local variables and the last yield position21:59
<cm_>Got to go but I write down issues/ideas. Keep up the good work!22:08
<arjanb>cu later
* cm_ leaves

Generated by Sualtam