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

<bonniot>how come you did not find the problem in nice.tools.compiler native.nice ?02:38
it should have been found after you changed the type of readLine
<arjanb>forgot the commit that one02:40
it was only one token02:41
<bonniot>ok02:44
<arjanb>i see you have commit that now that code must have been old, from a time when nice didn't have option-types yet02:49
<bonniot>yes02:50
<arjanb>goodnight02:58
* arjanb leaves02:59
* bonniot leaves03:04
* alexgreif joins13:06
* arjanb joins13:16
hi13:17
<alexgreif>hi13:25
* bonniot joins13:42
<alexgreif>hi
<bonniot>hello
<alexgreif>topic locations:13:43
how do I get the File? its a nested class in Location?
<bonniot>you can dispatch on Location.File13:44
<alexgreif>cast?
<bonniot>no
<alexgreif>I just upgrade the java version
not the nice one
<bonniot>oh. why?
in that case, you can use instanceof and cast, yes13:45
<alexgreif>because something does not go in the nice version as I want#
<bonniot>are you letting down the Nice version?
<alexgreif>I ported the code, but something is strange
NOOOOOO
<bonniot>good
so why are you working on the Java version?
<alexgreif>I just want to make log statements in both nad compare them
<bonniot>ok i understand13:46
<alexgreif>btw I have to tell that the nice version is a mjor struggle!!13:47
<bonniot>what's the problem?
<alexgreif>ok, in the java version I get a Location instance in the callback methods13:48
now I need the File of the location
<bonniot>as I said, use instanceof to see if it is a File location or not
<alexgreif>its a subclass, but in Location there is no method like getFile()13:49
<bonniot>sure, because every location does not have a File
<alexgreif>ah, but Location has a fielf currentFile
<bonniot>no, that's a static field13:50
<alexgreif>so the argument can be either File or Source or Option?
<bonniot>and currentFile is private, it's not for clients
yes
<alexgreif>but no Location because it abstract
<bonniot>Source is a subclass of File13:51
<alexgreif>aha, now I see it in my tool too :)
<bonniot>what tool?13:52
<alexgreif>on the mac, it can browse a zip/jar and with doubleclick it shows class infos like methods , subclass, fields, acc-modifiers13:53
its called ClassWrangler
<bonniot>ok
<alexgreif>belongs to the CodeWarrior IDE
<bonniot>so now you will be able to handle Files, instead of Strings :-)
<alexgreif>yep13:55
daniel: fyi, I almost finished the following plugin part: nice project creation. the wizard is running and the project is created too that shows nice files. Only one problem: after the createion of the project the resource vire in the nice perspective dies not refresh itself. Thats the point where I will compare the logs of bothe plugin versions14:08
<bonniot>that's a good start. good luck with the rest...14:11
<alexgreif>fortunately arjan is here most of the time because I have many questions 14:14
<bonniot>:-)14:20
<alexgreif>daniel: my brother drives today to budapest, visiting friends. He is the dylan guy I told you months ago15:11
<bonniot>luckilly it is pleasant temperature today. it used to be very hot!15:24
i don't rember the dylan episode15:26
<arjanb>alex: no problems or questions today? ;-)15:32
<alexgreif>I SOLVED THIS OBSCURE PROBLEM !!!!!!! Im so happy! now nice project creation works :))15:40
arjan: till now I did not implkement nice, but compared the old with the new version15:41
arjan: now that the problem is solved nice hacking goes on, and questions willl follow :))15:42
<arjanb>ok :-)15:43
<bonniot>well done alex!15:48
happy hacking :-)15:49
* bonniot leaves15:51
<alexgreif>arjan?17:29
<arjanb>yes17:30
<alexgreif>I have a strange thing:
I want to call a static method in a java class, and nicec says that the method os not declared17:31
but that should not be a prob is it?
<arjanb>no what is the signature?17:32
<alexgreif>public static void startPropagate(IPreferenceStore??target,
String??targetKey)
<arjanb>and how do you call this method?
<alexgreif>oh wait, I have other problems to solve first
strange that nicec complains an error in a line, but two lines before there is definitely another problem17:34
so nicec reports the problems not in the worder they occure in the source
<arjanb>that is possible17:35
<alexgreif>makes debugging a bit tricky because not all nicec errors are listed in the first run17:36
<arjanb>at which error message does the compiler stop17:38
<alexgreif>startPropagate is not declared17:39
but before this a not declared class is used in the source
other question:17:41
I vant to define a static variable that holds an instance of my NicePlugin. How should I do it the best way? 17:42
1) declare a field in NicePlugin and declare a getter?17:43
<arjanb>you can use just a global variable
<alexgreif>2) can I declare a variable in toplevel and set it from the NicePlugin initializer?
<arjanb>yes17:44
<alexgreif>do I reference a global var as if it were a class field?
<arjanb>no same as local var
<alexgreif>But I do I set the type to ?NicePlugin or NicePlugin and initialize it to cast(null) ?17:45
<arjanb>how do you use it17:47
<alexgreif>I want to use it as a constant or a global var that is only set once
<arjanb>where is it set? 17:49
in the NicePlugin class?
<alexgreif>yes in the initializer
I would do it like this:17:50
<arjanb>then it problably the easiest to use cast(null)
<alexgreif>class NicePlugin extends AbstractUIPlugin {
{
plugin = this;
}
}
var NicePlugin plugin = cast(null);
<arjanb>and the constructor of NicePlugin is called from eclipse?17:51
<alexgreif>yes
thats the first invocation of my plugin
<arjanb>then can you be sure that plugin is set correctly before the first use17:52
<alexgreif>yes17:53
or is it better to have it in the class as a field and write a global getter? If that is possible?
<arjanb>i don't think that's possible17:55
<alexgreif>I do neither because I have no handle to the NicePlugin instance17:56
daniel: fyi, opening a nice file in eclipse is working too19:29
arjan?21:04
<arjanb>yes21:06
<alexgreif>I want to write a method that has one arg that can be null. One version of this method should simply return null if the arg is null. How is the @ syntax ? I will try some...
?NiceProject getNiceProject(?IAdaptable);21:07
getNiceProject(selectedElement) {return null;}
getNiceProject(selectedElement@Null) {return null;}
<arjanb>getNiceProject(null) = null;
<alexgreif>for the last one? but I need the second line for the default. isnt it?21:08
<arjanb>yes but why does the default return null?21:09
<alexgreif>why not?
there wlill be some other decls21:10
I mean implememntations of the method
getNiceProject(selectedElement@NiceProject) = selectedElement;
getNiceProject(selectedElement@IProject) {
}
<arjanb>if the default does return null why do add one for the null argument21:11
<alexgreif>yes thats a good question :) ok, I leave the default one.
anway it was helpful to see the syntax for the null case. thanks21:14
<arjanb>you can use that syntax for any value pattern21:15
<alexgreif>like getNiceProject(IProject) {return ...} ?21:16
<arjanb>void foo(int n);21:17
foo(3) { ... }
foo(n) {...}21:18
<alexgreif>ah, so not the type but the value
and for Strings foo("test") {...} ?
<arjanb>yes21:19
<alexgreif>and for global objects like:
let String s = "hhh";
foo(s) {...}21:20
?
<arjanb>yes isn't easy
<alexgreif>but there is an amibuity? s could be just the name for the arg in the method scope. Does nicec determine whether s is defined globally?21:21
<arjanb>the name of a default implementation must be the same as the declaration21:22
<alexgreif>?
can the compiler distinguisch between21:23
let String s = "hhh";
foo(s) {...}
and
# let String s = "hhh";21:24
foo(s) {...}
# = //21:25
<arjanb>at the moment the coverage test will fail21:26
<alexgreif>I have a prob with that:21:27
?NiceProject getNiceProject(?IAdaptable);
getNiceProject(selectedElement@NiceProject) = selectedElement;
nicec tells:
No method called getNiceProject is compatible with these patterns21:28
for the second line
<arjanb>does NiceProject implement IAdaptable?
<alexgreif>no21:29
<arjanb>is should implement that21:31
all types of the implementation should be subtypes of the declaration21:32
<alexgreif>ok
its logical somehow. sorry for the Q.21:33
<arjanb>it's not completely logical21:36
<alexgreif>the original java code had the line "if (selectedElement instanceof NiceProject) ..." then this returned always false? 21:37
selectedElement had type selectedElement21:38
oops IAdaptable
<arjanb>no look at an example where such things can make sense:
interface I {}
abtract class X {}
class Y extends X implements I {}
void foo(I);
foo(@Y) { ... }
i mean foo(@X) { ... }21:39
<alexgreif>ah this one is trickier... does this compile?
<arjanb>not at the moment21:40
<alexgreif>because X does not implement I but Y does
<arjanb>yes
but the call new Y().foo() could make sense and match the @X pattern 21:42
<alexgreif>ok, but now the following question in java:21:43
NiceProject does not implement IAdaptable
IAdaptable selectedElement = ...;
if (selectedElement instanceof NiceProject) ...
this is always false istnt it?
<arjanb>not if you have a subclass of NiceProject that implement IAdaptable21:44
<alexgreif>but I dont have one
<arjanb>then it's always false21:45
<alexgreif>strange I got the java code from another plugin
never mind , fortunately nicec sees this problem :))
<arjanb>yes but nicec is a bit to restrictive at moment see my example21:46
<alexgreif>Im replacing a method with many "if (... instanceof ...)" with multimethods. I think it will be better this way21:47
<arjanb>yes it's possible to simulate multimethod with many instanceof's but why if the compiler can do these things for you21:49
<alexgreif>you mean I should leave all instace of in one methid with many if's? 21:50
<arjanb>nooo21:51
<alexgreif>maybe you misunderstood: I had a java method with many instanceof's. And I want to use multimethods in nice now. I think this is the right way.
So it becomes a compiler issue and not a runtime issue21:52
<arjanb>yes21:53
and it becomes easier to add new cases
<alexgreif>huh :) I thought I misunderstood the intention of multidispatch :)
yes
<arjanb>do you use the ruby plugin as starting point?22:05
<alexgreif>the java version of the nice plugin was a 1:1 port, but the nice version is more modern22:06
why?
<arjanb>because i'm interested in the difficulties of porting java code to nice22:08
<alexgreif>my questions are the best exmaple fot those difficulties :)22:09
<arjanb>maybe it's useful to keep a list of porting difficulties22:31
<alexgreif>we have a wiki page for this22:33
<arjanb>yes but porting is a bit different22:35
<alexgreif>for example the protected methods. I mean the trick you said
<arjanb>but that's a temporaly trick untill the compiler take care of that23:08

Generated by Sualtam