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

<arjanb>that bug is fixed now in cvs01:38
but i think you shouldn't use final fields in this case but toplevel constants01:40
the best translation of java final static fields are toplevel constants01:41
* arjanb leaves02:33
* alexgreif joins09:20
toplevel constants are not mentioned in the manual. Could somebody please give an example?09:21
after checking out the latest nice sources, I get an error while "make":09:22
[4] ~/project/Nice agreif% make
cd src/nice/tools/compiler; ./setBuildDate "0.9.1" "prerelease"
JAVA="java" /Users/agreif/project/Nice/bin/nicec --exclude-runtime -d "/Users/agreif/project/Nice/classes" --sourcepath="/Users/agreif/project/Nice/stdlib:/Users/agreif/project/Nice/src" -R bossa.syntax
nice.lang: parsing
nice.tools.ast: parsing
bossa.syntax: parsing
~/project/Nice/stdlib/nice/lang/numeric.nice: line 86, column 23:
Inlined method nice.lang.inline.UnaryNumOp was not found
~/project/Nice/stdlib/nice/lang/numeric.nice: line 86, column 23:
Inlined method nice.lang.inline.UnaryNumOp was not found
make: *** [compiler2] Error 2
* alexgreif leaves10:28
* arjanb joins11:03
alex i mean with toplevel constants the same as global constants11:16
let Class[] classes = [Test.class, Test2.class]; just like this but outside a class or method11:17
try using make complete for compiling nicec11:18
* arjanb leaves14:10
* alexgreif joins14:11
* arjanb joins14:44
hi
<alexgreif>hi15:03
<arjanb>all problems solved at the moment?15:05
<alexgreif>currently yes, that concernes nice. I still have an eclipse problem. My reources view does not want to show up15:06
arjan?16:11
<arjanb>yes16:12
<alexgreif>I have an array problem:
IProjectDescription description = project.getDescription();
String[] prevNatures = description.getNatureIds();
String[] newNatures = new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
nicec tells:
Incorrect type in assignment to newNatures
Found : ?java.lang.String[]
Expected: java.lang.String[]
<arjanb>yes the elements of a new array are maybe null16:13
<alexgreif>what can I do?
?String[] newNatures16:14
<arjanb>what do you want to do with the new array?
<alexgreif>System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);16:15
newNatures[prevNatures.length] = NICE_NATURE_ID;
description.setNatureIds(newNatures);
<arjanb>try description.setNatureIds(description.getNatureIds()+[Nice_Nature_ID]);16:16
<alexgreif>Incorrect type in assignment to newNatures16:18
Found : ?java.lang.String[]
Expected: java.lang.String[]
ahh wait
Method setNatureIds expects parameters (org.eclipse.core.resources.IProjectDescription, java.lang.String[?])16:21
16:23
Now I have:
IProjectDescription description = project.getDescription();
String [?] n = description.setNatureIds()+[NICE_NATURE_ID];
description.setNatureIds(n);
but I still get :16:24
Method setNatureIds expects parameters (org.eclipse.core.resources.IProjectDescription, java.lang.String[?])
<arjanb>that's strange
have you tried to reype this method?16:25
<alexgreif>no
<arjanb>i don't see any reason for this error16:29
can you try a retyping to see if it helps?16:30
<alexgreif>Im already trying16:31
the following does not compile:16:33
void setNatureIds(IProjectDescription, String[?]) = native void IProjectDescription.setNatureIds(String[]);
Method setNatureIds expects parameters (IProjectDescription, ?nice.lang.Array<String>)
<arjanb>leave the ? in the retyping away 16:34
<alexgreif>Method setNatureIds expects parameters (IProjectDescription, nice.lang.Array<String>)16:36
<arjanb>is that the complete error message?
<alexgreif>yes16:37
<arjanb>try add a fake method like : void setNatureIds(int ,int) {} to get a better errormesssage16:38
<alexgreif>nicec:16:39
No method with name setNatureIds has 1 arguments
I put it on toplevel. 16:40
<arjanb>at which line do you get this error
<alexgreif>in the lione:
String [?] n = description.setNatureIds()+[NICE_NATURE_ID];
<arjanb>replace set with get 16:41
<alexgreif>I commented "void setNatureIds(int ,int) {}" out, now I get:16:42
Arguments (org.eclipse.core.resources.IProjectDescription, java.lang.String[?]) do not fit:
nice.lang.void setNatureIds(IProjectDescription, nice.lang.Array<String>)
in line:16:43
description.setNatureIds(n);
<arjanb>change String[?] n = to String[] n =
<alexgreif>I removed the retyping and now it compiles16:44
I also changed what you ment, it recompiles fine too
16:46
now I have:
IProjectDescription description = project.getDescription();
description.setNatureIds(description.getNatureIds()+[NICE_NATURE_ID]);
project.setDescription(description, monitor);
and it works fine! thanks!
<arjanb>+ is overloaded for array and list concats16:47
<alexgreif>for collections in general?
<arjanb>not for collection only lists16:48
but it could easily changed that it works for collection too16:49
<alexgreif>maybe it would be useful16:50
* alexgreif leaves17:44
* arjanb leaves18:03
* arjanb joins19:04
* bonniot joins19:47
hi
what was the problem with alex's array code?19:48
<arjanb>hi19:50
alex didn't know how to add element to an array19:51
i have been thinking shouldn't have Class a type parameter19:53
<bonniot>what would it mean?19:56
<arjanb>the typeparameter would be the type of the class it represents19:58
<bonniot>so getClass would have type <T> (T)->Class<T>20:02
<arjanb>yes20:03
<bonniot>i'm afraid it would be difficult to typecheck this statically, but it could be fun trying
when yould it be useful?
<arjanb>in method signatures and in the java prototype signatures class has also a type parameter20:07
<bonniot>in the proto for java 1.5?20:08
<arjanb>yes20:09
<bonniot>and when is it used?20:10
<arjanb>in the current prototype only in the Class class itself example method:20:12
public T newInstance() throws InstantiationException, IllegalAccessException;
<bonniot>nice, so that method becomes type safe20:14
<arjanb>yes20:16
<bonniot>the problem is that it will be necessary to retype all methods that take a Class argument
not practical for alex these days...
something else: have you looked at adding testcases for the missing locations?20:17
<arjanb>yes but i couldn't find one20:18
<bonniot>did you try changin == null with == "" ?20:19
<arjanb>yes but then you get the argument don't fit method error wich use the location of the ==20:20
<bonniot>and which location was wrong? the expression itself?20:22
<arjanb>yes
<bonniot>what kind of expression had no location?20:23
<arjanb>some method calls / fieldaccesses
<bonniot>what about boolean wrongType = <expression>20:26
where expression is one of those, and does not have type boolean?
<arjanb>no that expression does have a location20:28
only expressions that were arguments to operators didn't have locations20:29
<bonniot>i see
well, never mind then
<arjanb>btw how is your dissertation going?20:36
<bonniot>its ok, making progress. I should be finished writing by the end of August20:41
<arjanb>i thought that it's going well because you still have time for the compiler :-)20:45
<bonniot>:-)20:46
<arjanb>what do you of alex suggestion that `+` should work for collections too20:49
do you think of ?
<bonniot>yeah, no problem. but what would be the result? an ArrayList like now?20:51
<arjanb>the same thing as the first argument ? but i think `+` doesn't make much sense for every collection20:54
i think operator may only be overloaded when everyone expect the same thing what it does20:59
<bonniot>there is Collection.addAll, but it is an optional operation
agreed
was + needed for a Collection, or was it just an abstract idea?21:00
<arjanb>just an idea of alex
* alexgreif joins21:02
hi guys21:03
<arjanb>hi21:04
daniel why is optionOr overloaded? !T `||`(?T e1, !T e2) ?T `||`(?T e1, ?T e2)21:20
<bonniot>hello alex21:41
<alexgreif>hi daniel
<bonniot>arjanb: because if you do x || new X() then you want to know the result is not null21:42
but you also want to allow x || y where both might be null
<alexgreif>after overriding a method in a subclass I get the message: 21:43
There is an ambiguity about which version of the overloaded method "getAdapter" this alternative belongs to.
Try to use more patterns.
I have the method with the same name also in two other classes, but I dont understand why nicec sees an ambiguity21:44
here is the code:
class NiceResourceNavigator extends ResourceNavigator {
NiceResourcesView niceResourcesView;
getAdapter(clazz) = niceResourcesView.getAdapter(clazz);
}
I dont know how to specify more patterns for method getAdapter :(21:45
<arjanb>what are the method declarations of getAdapter?
<alexgreif>getAdapter(Class??adapter) 21:46
returntype is Object
<arjanb>and the other
<alexgreif>the type of the arg?
<arjanb>the other declaration of getAdapter21:47
<alexgreif>Possible methods:
java.lang.Object getAdapter(org.eclipse.ui.part.WorkbenchPart, ?java.lang.Class) defined ./net/sf/nice/core/NiceProject.nice
java.lang.Object getAdapter(org.eclipse.core.runtime.IAdaptable, ?java.lang.Class) defined ./net/sf/nice/core/NiceProject.nice
always one arg, a Class21:48
and always Object as ret type
<arjanb>so NiceResourceNavigator implements both IAdaptable and WorkbenchPart?21:49
<alexgreif>All Implemented Interfaces: 21:50
IAdaptable, IExecutableExtension, IResourceNavigator, ISetSelectionTarget, IViewPart, IWorkbenchPart
yes both and some more
ok the I see the ambig. but how to avoid this?
<arjanb>you can implement your method outside the class21:51
<alexgreif>with the @ syntax?
<arjanb>yes
<alexgreif>getAdapter(navi@ResourceNavigator, Class clazz) = navi.niceResourcesView.getAdapter(clazz);21:53
tells me:
Encountered "clazz".
Was expecting one of:
"(" ...
<arjanb>getAdapter(navi@NiceResourceNavigator, clazz) = ...21:54
<alexgreif>ah, without Class
<arjanb>and then to resolve the ambiguity:
<alexgreif>still There is an ambiguity about which version of the overloaded method "getAdapter" this alternative belongs to.21:55
<arjanb>getAdapter(navi@NiceResourceNavigator(ResourceNavigator), clazz) = ...
<alexgreif>ist this new? I dont remember to heva seeen this syntax in the manual21:57
<arjanb>i think some advanced things are still missing in the manual
added to the list of missing things22:02
does it work now?22:05
<alexgreif>yes, this problem is gone
Im struugling with the next
<arjanb>what?22:07
<alexgreif>IStructuredSelection sel = openEvent.getSelection();
view.getMainActionGroup().runDefaultAction(sel);
No possible call for getSelection.22:08
Arguments: (?org.eclipse.jface.viewers.OpenEvent(openEvent))
Possibilities:
org.eclipse.jface.viewers.ISelection getSelection(org.eclipse.ui.part.ShowInContext)
org.eclipse.jface.viewers.ISelection getSelection(org.eclipse.ui.actions.ActionContext)
org.eclipse.swt.widgets.TreeItem[] getSelection(org.eclipse.swt.widgets.Tree)
org.eclipse.jface.viewers.ISelection getSelection(org.eclipse.jface.viewers.OpenEvent)
org.eclipse.jface.viewers.ISelection getSelection(org.eclipse.jface.viewers.DoubleClickEvent)
org.eclipse.jface.viewers.ISelection getSelection(org.eclipse.jface.viewers.Viewer)
nice.lang.boolean getSelection(org.eclipse.swt.widgets.ToolItem)
org.eclipse.ui.IWorkingSet[] getSelection(org.eclipse.ui.dialogs.IWorkingSetSelectionDialog)
org.eclipse.ui.IWorkingSet getSelection(org.eclipse.ui.dialogs.IWorkingSetEditWizard)
org.eclipse.jface.viewers.ISelection getSelection(org.eclipse.ui.ISelectionService)
org.eclipse.jface.viewers.ISelection getSelection(org.eclipse.jface.viewers.SelectionChangedEvent)
org.eclipse.jface.viewers.ISelection getSelection(org.eclipse.jface.viewers.ISelectionProvider)
nice.lang.boolean getSelection(org.eclipse.swt.widgets.Button)
nice.lang.int getSelection(org.eclipse.swt.widgets.ScrollBar)
nice.lang.boolean getSelection(org.eclipse.swt.widgets.MenuItem)
<arjanb>do you see that ? after arguments22:09
<alexgreif>in the line Arguments: (?org.eclipse.jface.viewers.OpenEvent(openEvent))22:10
?
so openEvnet can be null
<arjanb>yes and yes22:11
how do you get openEvent?
<alexgreif>open(openEvent) {...}
overridden method from java api
<arjanb>than you have to retype that method22:12
<alexgreif>I have to chekc for null? or use notNull()?
is this right?:22:16
void open(IOpenListener, OpenEvent) = native void IOpenListener.open(OpenEvent);
<arjanb>yes
<alexgreif>seems to cimpile. Im not sure because of the IOpenListener interface
? on the right side are always wrong?22:17
they can only occur on the nice(right) side?
<arjanb>yes java doesn't have a ?
<alexgreif>but every java type is a ? (might null) type22:18
so in this case we retype a java type to a nice (not null) type?22:19
<arjanb>the compiler guesses a retyping for every java method but it isn't always correct so then you have to retype it yourself22:20
<alexgreif>coding nice against a java api can be quite frustrating :((22:21
it would be fine to have all this eclipse code in nice 22:22
<arjanb>you can try to use the --strict switch to the compiler for a different retype guessing strategy but i think then you have to retype much more manually22:23
<alexgreif>its not so much currently but Im not used to it
<arjanb>it would be great if they wrote eclipse in nice but first we have to get everyone using nice instead of java22:25
<alexgreif>the first step is the plugin :)22:26
<arjanb>:-)
<alexgreif>next prob:22:32
getAdapter(navi@ResourceNavigator(ResourceNavigator),clazz) = navi.niceResourcesView.getAdapter(clazz);
nicec:22:33
No possible call for niceResourcesView.
Arguments: (org.eclipse.ui.part.WorkbenchPart(navi))
Possibilities:
Field access to net.sf.nice.ui.views.NiceResourcesView niceResourcesView
Field access to net.sf.nice.ui.views.NiceResourcesView niceResourcesView
<arjanb>insert after @ Nice
<alexgreif>thanks!22:34
it looked strange anyway two times ResourceNavigator22:35
finally the beast compiles
<bonniot>it looks like a bug that the fiel access was written twice22:46
can somebody try to reproduce this bug?
<alexgreif>yes it was written twice22:47
daniel: I reproduced it in the plugin context. does it help you?22:50
<arjanb>i don't think it's a bug22:53
<alexgreif>is it a coincidence?22:54
<arjanb>yes
<bonniot>alexgreif: it would be good if it was self-contained
<arjanb>class Q {
String foo = "abc";
}
abstract class X {
String bar();
}
class Y extends X {
String foo = "abc";
}
bar(t@X) = t.foo;
<bonniot>but in alex's case the fields are the same (same class)22:55
<arjanb>also in this case
No possible call for foo.22:56
Arguments: (my.test6.X(t))
Possibilities:
Field access to java.lang.String foo = "abc"
Field access to java.lang.String foo = "abc"
i think the class where the field belongs to should also be printed for a fieldaccess22:57
<bonniot>yes, that would help in any case22:59
<arjanb>i'm changing that now23:03
<bonniot>ok23:04
<alexgreif>arjan: how is the output after the fix?23:11
<arjanb>No possible call for foo.23:13
Arguments: (my.test6.X(t))
Possibilities:
Field access to java.lang.String foo in class my.test6.Y
Field access to java.lang.String foo in class my.test6.Q
or do you have a better idea?
<alexgreif>no, I dont 23:14
maybe my.test6 (Y)
<arjanb>my.test6 is the package23:15
<alexgreif>so its the fully qualified class name
<arjanb>yes
<alexgreif>ok, its fine23:16
<bonniot>What about:
Field my.test6.Y.foo23:17
or
java.lang.String my.test6.Y.foo23:18
<arjanb>or Access to field my.test6.Y.foo23:20
alex what do you think?23:21
<bonniot>Why "Access to" ? It seems redundant to me
<alexgreif>java.lang.String my.test6.Y.foo23:22
its short and contains everything
<bonniot>yet. it is natural, because that's the way users define their fields
yes
i think the reason there was "Field access to " is that in the compiler, there is a class FieldAccess23:23
so this String was for debugging, to know it came from that class
it was not intended to be printed
<arjanb>Field java.lang.String my.test6.Y.foo otherwise the header of the error is strange 23:24
<bonniot>when it is a method, it is not written "Method ..."23:27
<arjanb>i have now:23:37
No possible call for foo.
Arguments: (my.test6.X(t))
Possibilities:
java.lang.String my.test6.Y.foo
java.lang.String my.test6.Q.foo
<bonniot>ok, can you commit it? i am working on fields too :-)23:44
<arjanb>done23:45
<bonniot>thanks, it's much better now23:55
<arjanb>alex have you encounter more little problems? we tend to overlook such things but they are important for the beginning user23:57
* alexgreif leaves00:13
<bonniot>the first program with overriden field is working :-)00:22
<arjanb>:-000:28
* arjanb leaves01:04
* arjanb joins01:07
<bonniot>did you know that in Java you can declare a field in a subclass with the same name as one in a parent?01:11
it seems like a confusing thing to do...
<arjanb>yes and didn't we discussed that earlier?01:13
<bonniot>I don't remember01:15
<arjanb>last quarter of the log of 17-0601:16
not much usefull there01:17
but i found it confusing too01:18
<bonniot>is there any reason to allow it?01:19
<arjanb>only for private fields01:20
if it makes the implementation more difficult it could be not allowed for now01:23
<bonniot>yes, since visibility info is not available yet anyway01:37

Generated by Sualtam