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

Using timezone: Central European Time
<GummiEnte>Welcome back | log17:33
I've adjusted the loggers timezone to CET...17:34
What do you think of the Howto? Is it clear enough? Do you think, someone can use it?17:35
<GummiEnte>Hello :)
<arjanb>yes the howto is quite clear17:42
<GummiEnte>And usefull?
<arjanb>surely for everyone using nice and gcj17:43
<GummiEnte>Ok, so my work will hopefully be not for nothing.17:44
http://pauillac.inria.fr/~bonniot/nice@freenode/ <-- is now completly offline?17:46
<arjanb>it looks like the whole site is down17:47
<GummiEnte>Yes :(
The anon-CVS is stil not in sync :(17:48
<arjanb>were you looking for something?
<GummiEnte>? where do you mean =
I just wanted to see, if Daniel has started the logger again...17:49
But you might also have noticed that, cause it seems so, as if you were most of the time your PC is on, also in this chat...
<GummiEnte>Uuups. Arjan, how to use a hashmap in nice without the type parameters?17:56
<GummiEnte>Cause, the gnu-crypto package needs an HashMap with Strings as key (ok, 1 type can be set) and the values are Objects or arrays or or or...17:59
Well, you can reduce it to objects and byte arrays.
<arjanb>do you use that hashMap as argument to a gnu-crypto function?18:00
<GummiEnte>Yes, it is used to initialisise the en/de-cryption algorithms18:01
<arjanb>can you give an example of a call?18:02
<GummiEnte>Well, actually only a java.util.Map is required.
Ok, soe lines of code:18:03
attributes = new HashMap();
byte[] key = new byte[cs];
for (byte j=0; j<key.length; j++)
attributes.put(IMode.KEY_MATERIAL, key);
attributes.put(IMode.CIPHER_BLOCK_SIZE, new Integer(cs));
attributes.put(IMode.STATE, new Integer(IMode.ENCRYPTION));
Ok, the key is not that good at the moment ;)
Here's the api for that call: http://www.gnu.org/software/gnu-crypto/api/gnu/crypto/cipher/IBlockCipher.html#init(java.util.Map)18:05
<arjanb>quite an odd use of an Map18:07
<GummiEnte>Yes, it is.
<arjanb>a moment i'm trying an easy workaround18:09
btw. I'm using quite heavy mix of java and nice; I mostly not deleted all the targets and so a step by step implementation of interfaces and classes worked as normal, than I had to clean my targets directory, and nothing was compilable any longer, because java classes depend on nice classes and vice versa. That was funny but also unlucky. Now I'm playing around with some dummy classes to first compile nice and then the java stuff.18:12
You might ask, why...
<arjanb>the compiler does something like that for bootstrapping18:13
<GummiEnte>... it is just abut the missing nicedoc feature and the good interface style of decalring constants.
...well, maybe good is wrong word, but it gives a good overview.18:14
...so, that should work without any problems to use dummies with only the methods without real content, should it?
In C it works, in Java it also should, so in nice also...18:15
...since you "only" link against the header of the methods, isnÄt it?18:16
<arjanb>look at the makefile and nice\bossa\syntax\dispatch.java.bootstrap for how nicec does it18:17
as for the map the following works:18:18
Map<String,Object> map = new HashMap();
map["abc"] = object(10);
map["xyz"] = object([1,2,3,4]);
<GummiEnte>So, the follwoing should also work?:18:19
byte[] ba = ...
map["xxx"] = object (ba);
<arjanb>map["abc"] = ... is equal for map.put("abc", ...)
equal to
<GummiEnte>The dummy class is exctlly that what I'm doing.18:20
Ok, what are the words I can use to "cast"?
So far I know cast(...), notNull(...) and now object(...).
<arjanb>notNull isn't a cast but a runtime assertion18:21
<GummiEnte>That does not work with arbitrary class names... Does it work with primitive names like int, byte, short, long,...?
Yes, sorry. I know about the difference.
<GummiEnte>ok, so there are casts in nice. Somewhere was stated there are not.18:23
<arjanb>not really primitive(...) is only a conversion thing
<GummiEnte>...except cast(...)...18:24
yes, you're right. but in the jvm spec they call the conversion also cast...
good to know about that. :)18:25
...I don't know, if I'm right with the following:
Is it possible to have a variable of type B and assign it a value of type C where C extends B?18:26
<arjanb>cast's can be needed in rare cases where the type system leaves you
<GummiEnte>I have to use them quite often...
<arjanb>hmm could you put some of these cases on http://nice.sourceforge.net/cgi-bin/twiki/view/Dev/NiceCasts18:28
what do you mean with assign it a value of type C?18:29
<GummiEnte>A concrete example:18:30
class A{}18:31
class B extends A{}
var a = new A();
var b = new B();18:32
a = b; <-- does that work?
... I'm not quite sure, if it does... Maybe I mix it with something else.18:33
<arjanb>yes that works
any problems with something like that?18:34
<GummiEnte>I'm not quite sure, where I got something, but I have something like that in my mind.
Ah, another thing I just encoutered: A interface A contains variable foo and and interface B extends interface A. 18:35
In Java it is possible to use B.foo but in nice it isn't.
Class gnu.crypto.mode.IMode has no static method or static field named KEY_MATERIAL18:36
<arjanb>i need to look at that, do you know such a case in the java api?18:38
<GummiEnte>So that an interface A extends an interface B... Well, in the event system I'm sure there will be something like that.18:39
Interface RSAPrivateKey
<GummiEnte>There a variable/field serialVersionUID is inherited from interface java.security.PrivateKey
<arjanb>it looks a bug in the compiler18:45
<GummiEnte>Ok, most of my casts I've done due to the instanceof issue. That now works for easy cases, but hopefully soon for complex cases like:
if (! (a instanceof FOO)) throw Exception();18:46
var FOO b = a;
or the other scenaries we already discussed.
most other cast were notNull assertions.18:48
<GummiEnte>does the following now work:
if (a instanceof B<:A>) {18:50
a = new A();
<arjanb>not sure18:51
<GummiEnte>I'm happy to find something, that could be improved (like bugs) :)
...last was meant about the inherited fields in interfaces...
I'm just trying it...18:52
...yeah it does work... so I can reduce the casts a lot...
Well, for one thing, I'm still using casts: I want to profit from the type system of nice, so I'm mostly using non-null member-variables of classes. So during initilisation the needed values are automatically constructed, but beforce I need to delcare the variables with cast(null)...18:57
<arjanb>can you give a little example?
well i have to eat first back in half an out18:58
Enjoy your meal!
Enjoy your meal!
In the meantime, I'll give you the example:18:59
class Env {19:00
Env global_env = cast(null);
VariableLayer global_layer = new VariableLayer(env: cast(null), topLayer: cast(null), static_layer: true);19:01
if (global_env == null)
global_env = this;
global_layer.env = this;
global_layer.topLayer = global_env.global_layer;
So, as you can see, after initilisation, all cast(null) are filled with real objects...19:03
...I'm somehow emulation two constructors; one with and one without the "global_env" variable. If called without the floabl_env will get created, otherwise (so with the gloabl_env as parameter) the env is just a subenvironment of the global_env.19:06
Ah, and for the instanceof's not to forget the following case:19:24
var ?A a;
if (a instanceof A) {
memberVariableType member = a.memberVariable;19:26
That does not work at the moment (with my compiler), cause for a it is not known, that is must be != null.
It also seems, that the following does not work:19:29
if (array_of_typeA[j] instanceof A) {
A a = array_of_typeA[j];19:30
Are you again here?20:15
<GummiEnte>Have you got my example and noticed the instanceof szenarios?20:18
And another question: How to create an uninitialisised array of Strings?20:23
The following does not work:
<arjanb>in the last example you need to put the array element in a local variable
<GummiEnte>String[] rest_args = new String[args.length-1];
Ah, that is also good.20:24
Do I need ?String[] rest_args = ...?20:25
<arjanb>i don't get a error in the other instanceof case20:27
<GummiEnte>with an ?A ?!
<GummiEnte>Ok, than my compiler might be again to old :(... The anon-CVS becomes anoying...
<arjanb>how old is the development version?
<GummiEnte>Nice compiler version 0.9.3 prerelease (build 2003.09.24, 17:08:43 UTC)20:29
Compiled using JDK 1.3.0Nice compiler version 0.9.3 prerelease (build 2003.09.24, 17:08:43 UTC)
Compiled using JDK 1.3.0
<arjanb>more than a week :(20:31
<GummiEnte>Yes, my access to cvs is since that unavailable...20:32
<arjanb>about constructors have you seen daniel proposal?: http://nice.sourceforge.net/cgi-bin/twiki/view/Dev/CustomConstructors20:33
<GummiEnte>No, I'll have a look at it.
<arjanb>maybe you have idea to solve the cast(null) things at construction20:34
<GummiEnte>It' difficult, even more, if you want to be as comfortable as possible for both nice and java...20:35
<GummiEnte>Initilizers are just executes after the object is created?, right? Or is it, when the object is first accessed?20:43
<arjanb>immediately after creation
<GummiEnte>Ok. I'll leave now and tonight I'll let my mind think about the constructors...20:44
...cu tomorrow.
* GummiEnte leaves20:45

Generated by Sualtam