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

Using timezone: Central European Time
<bonniot>how is pluk?00:10
<Bluelive>pretty much dead00:46
functioning as planned, is another description :)00:47
if i can get a new host maybe ill revive the webserver
i might use it to compile to native for newer projects00:48
<bonniot>ie it will be your backend ???00:56
* arjanb leaves03:04
* bonniot leaves03:44
* fcb joins09:03
* bonniot joins11:28
hi11:29
<Bluelive>hi12:06
<fcb>hello all13:25
does Nice support regular expressions?
* zzorn joins13:32
<bonniot>not natively, but you can use a library13:38
<fcb>you mean one written for java?
<Bluelive>you could use the one that comes with java yes13:39
<fcb>is that a 1.5 thing?13:40
<Bluelive>im not sure, i think its from 1.413:44
<fcb>cool
bonniot: I need to get the packages of the argumens to a MethodDeclaration. I have found that I can get an mlsub.typing.Monotype, but the toString() doesn't always seem to display the package.13:52
* arjanb joins13:57
<bonniot>fcb: do you have an example?13:58
hi arjan
<arjanb>hi13:59
<bonniot>fcb: java.util.regex is in 1.414:00
do you need it for nicedoc?
<fcb>would be nice but can do without14:01
<bonniot>what for?14:03
<fcb>parsing comments, doing substitutions, etc. they are just convenient14:08
<bonniot>yep
what about getting package? in what case is it not working?14:10
what code are you using?14:11
<fcb>Here is my example:14:12
MethodDeclaration m;
println(" getReturnType(): " m.getReturnType());
println(" getArgTypes(): " m.getArgTypes());
for(mlsub.typing.Monotype type : m.getArgTypes())
println(" " type);
<bonniot>ok, and do you have an example where you don't get the package?14:14
or you never get it?
<fcb>Sym doesn't have a package in this method.
<Sym> nice.lang.void set(nice.tools.ast.SymbolTable<Sym> this, String name, Sym sym)14:15
Normally I do get a package in the toString()
<bonniot>ok
that's normal, Sym is a type parameter, it does not belong to any particular package
is that for creating hyperlinks?14:16
<fcb>yep14:17
<bonniot>I don't think Sym should link to anything
<fcb>ok, so as a rule of thumb, if I can't find a package I simply won't provide a hyperlink14:18
<bonniot>sounds find
fine ;-)
<fcb>is it ok if I use regexps?14:19
<bonniot>I think there should be a method ?Package getPackage(mlsub.typing.Monotype type);
<fcb>really? that method would be very good - I'll see if I can find it14:20
<bonniot>no, I don't think it exists yet
but it shouldn't be very hard to write14:21
the point is to isolate the details of how to perform this operation in a method
now the question is where this method belong (in what package)
i suppose not in nicedoc, because it could be useful to other tools, like editor plugins14:22
i guess i could add it to bossa.syntax
<CIA-2>03bonniot * 10Nice/src/nice/tools/compiler/native.nice: 14:23
Use threads to read stdout and stderr instead of actively polling for output.
Doubles native compilation speed.
<bonniot>fcb: do you rather need the Package or a String?14:25
<CIA-2>03bonniot * 10Nice/NEWS: Typo.
<fcb>doesn't really matter much. what I need at the other end is ../../my/package/Class.html14:27
so I suppose a string is ok because I can replace . with / (or \)
<bonniot>what if the type is List<String> ?14:28
don't you want <a href="java/util/List.html">List</a><<a href="java/lang/String.html">String</a> ?14:29
> at the end14:30
<fcb>I suppose that would be even better14:31
<bonniot>sounds like a good job for a multimethod ;-)14:34
<fcb>but as long as I can get the package I can do that, too
what do you mean?14:35
<bonniot>String linked(Monotype type);14:37
linked(type) = type.toString();
linked(MonotypeConstructor mc) =
linked(mc.head()) + "<" + join(mc.getTP().map(linked), ",") + ">";
<fcb>to be honest with you, I don't understand that code14:39
it looks like you have an rvlaue as an lvalue: linked(type) = type.toString();14:40
<bonniot>you know map and join?
it's a method implementation, the default case
see what I mean?14:43
String linked(Monotype type) = type.toString();
would be fine too. it declares a method *and* gives it a default implementation
<fcb>but that won't provide you with a link. will it?14:44
<bonniot>that's just the default case. for type parameters for instance
that's why there is the other line
this should be the complete implementation:14:45
String linked(Monotype type);
<fcb>ok. I'm still struggling, though.
<bonniot>linked(type) = type.toString();
linked(MonotypeConstructor mc) =
linkedTC(mc.head()) + "<" + join(mc.getTP().map(linked), ",") + ">";
String linkedTC(TypeConstructor tc)
{
let name = tc.toString();
if (name.indexOf('.') == -1)
return name;
let ref = name.replace('.', File.separatorChar);
return "<a href=\""ref".html\">"name"</a>";
}
<fcb>where does linked come from in map(linked)14:47
<bonniot>it's a recursive call14:48
that will handle the String in List<String>
actually, we need to check if there are type parameters (TP), because if there are none we should not print <> at all:14:49
linked(MonotypeConstructor mc) =
mc.getTP() == null
? linkedTC(mc.head())
: linkedTC(mc.head()) + "<" + join(mc.getTP().map(linked), ",") + ">";
<fcb>I still don't get it. linked has no arguments14:50
<bonniot>you pass the method itself. map will call it with each element in mc.getTP()14:51
<fcb>oh, ok. no worries. where is myh MonotypeConstructor coming from?14:52
<bonniot>it's like: [1,2,3].map(-); - has one argument, an int, which will be taken from the list
MonotypeConstructor is a subclass of Monotype14:53
so you just call linked on a Monotype, and that code will be chosen when it is applicable
<fcb>so I'm only worried about MonotypeConstructors?14:54
<bonniot>mostly
you should refine for other cases, like function types and tuples14:55
<fcb>why MonotypeConstructor?
<bonniot>why the name?
<fcb>well, what is it? When I call getReturnType(), why does it return a MonotypeConstructor. I didn't think I was getting a constructor back, but a reference to an object.14:57
<bonniot>it's actually a bad name. it should be ConstructedMonotype14:58
<fcb>:)
probably be quicker for you to write nicedoc yourself than teach me how it works :)
<bonniot>the idea it's that it's a monotype constructed by the application of a type constructor (like List) to monotypes, like String, which gives List<String>14:59
not really. it's quite fine to have to answer a question once in a while, but you are doing lots of good work, and I can focus on other things15:00
also, it's good for you because you are learning, and maybe you can help with other things when nicedoc is just perfect ;-))
<fcb>hopefull :D15:01
I meant: hopefully
<bonniot>different meaning in that context ;-)
but I guessed it was so
<fcb>ok. excellent. thanks a lot for you help. I think I now have something to work on for a bit. No doubt I'll get stuck again in a couple of days ;)15:09
time for me to go, I think. See you later!15:13
* fcb leaves15:14
* Bluelive leaves15:43
<CIA-2>03bonniot * 10Nice/NEWS: Mention smaller classes and faster native compilation.17:00
* Ancelucci joins17:44
Hola
soy nuevo aqui
<bonniot>Hola! This is usually an english speaking channel ;-)17:45
* Ancelucci leaves17:46
* bonniot leaves23:30
* bonniot joins23:31

Generated by Sualtam