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

Using timezone: Greenwich Mean Time
* bonniot joins10:21
* arjanb joins11:38
<bonniot>hello14:36
arjan, are you there?15:07
<arjanb>hi15:08
<bonniot>i've been thinking about a different semantics for DTI (dyn.typ.inf.):15:09
if (exp == null) {
here, we work on a copy of exp, even if it is a complex expression15:10
}
then we would need no special handling for capture, and it would also work for fields, ...
i think it is also intuitive15:11
what do you think?15:13
<arjanb>then dozen copies could be hanging around
<bonniot>when i say copy i just mean a copy of the reference
it is like a local variable, so it only leaves as long as the branch15:14
<arjanb>so an implicit new local variable
<bonniot>yes, that's the way it would be implemented
so?15:20
<arjanb>how would it affect the behavior of captured variables?15:21
<bonniot>since we work on a copy, a modification of the caputed variable does not affect us15:22
<arjanb>String x = ...15:26
()->void dup = () => { x = x+x; };
if (x instanceof String)
{
dup();
println(x);
} 15:27
<bonniot>that would print the old x15:28
<arjanb>that is unexpected behaviour to me15:35
<bonniot>it would be the same with the modification of closures with copies15:37
(for code inside anonymous functions)
<arjanb>that's quite different15:41
<bonniot>whyM
?
<arjanb>i haven't seen code where something from the outside is changing captured variables while running inside the body of a closure15:42
<bonniot>l.foreach(int i => if (x instanceof String) { dup(i); println(x); });15:44
with dup that takes an int argument15:45
<arjanb>i see15:47
<bonniot>one possibility it to only use the copy before any possible side effect occurs15:48
that would handle cases like
if (x != null) foo(x);
calling foo with a copy of x, which is surely not null15:49
but then if you call any method, it would discard the info
that could be frustrating
<arjanb>i think it's better to look for some way to mark closure that can escape15:53
<bonniot>yes, that can help15:55
the case of fields would also be good to handle
<arjanb>it's possible whitout copy for final fields but that can be broken when it is a property15:57
<bonniot>the semantics of the jvm already includes the copy of fields in some way16:00
<arjanb>X x = ...16:03
if (x.y != null)
{
dosomething(x.y);16:04
x.y = ...
doanotherthing(x.y);
}
<bonniot>yes?16:05
<arjanb>what will happen at x.y = ... ?16:06
<bonniot>in the JVM?16:07
i mean by the JVM spec?
<arjanb>no if you want to copy fields to local variables
<bonniot>but the JVM might already do it anyway16:09
it means that another thread might read the old value of x.y
if there is no synchronization
<arjanb>i didn't know this16:11
where did you found this?
<bonniot>it's part of the JVM spec
(but the presentation is a bit dry...)
<arjanb>so it's doable for normal fields16:18
<bonniot>... if we follow certain rules. also, with properties, the setting changes somewhat16:21
<arjanb>the nasty details :-(16:27
<bonniot>0.9.5 is out in the wild :-)16:33
i'll wait a bit for the sf notification
* Bluelive leaves16:36
<bonniot>i'll be away for at least a few hours16:38
bye
* bonniot leaves
* Whoaguy joins18:13
* Whoaguy leaves
* bonniot joins19:47
hello19:54
<arjanb>hi20:09
so what's next?20:18
<bonniot>mainly, custom constructors and properties20:25
how are you doing with constructors?
<arjanb>haven't retried yet20:26
<bonniot>do you have a global idea how to implement them?20:29
<arjanb>i thought i did
<bonniot>so can you clarify the problem?20:32
<arjanb>it's a bigger change than i first thought20:34
custom constructor should be included in package.nicei and code generation can't be done with the existing things20:36
<bonniot>for package.nicei, it should be enough to print them as they were originally, and you can ignore that aspect in a first step20:37
actually, my advice is to focus on one pass at a time, so you can post-pone code generation until analysis and typeckecing are working20:38
i'm away for supper...20:40
<arjanb>i thinking about commiting the parsing part with an error message21:26
<bonniot>can you send me the diff first?22:06
i accepted, but the transfer does not start22:17
<arjanb>strange i retry22:18
yesterday it just worked22:22
<bonniot>i can read email now :-)22:23
<arjanb>send by mail22:29
<bonniot>does this compile? CustomConstructor is completely commented, but the parser calls new CustomConstructor(...)22:51
<arjanb>just uncomment it
it gives an NPE when running the testcase22:55
<bonniot>your changes?22:59
<arjanb>wdym?23:01
<bonniot>is it your changes causing the NPE?23:06
<arjanb>yes in the custom constructor testcase23:07
<bonniot>did you remove their BUG marker?23:26
<arjanb>i think so
<bonniot>yes, otherwise you would not see the NPE23:29
it's ok with me if you want to commit something, provided it compiles and does not cause regressions23:38
i will probably have more time to look at it tomorrow00:09
tell me if you need help
now i'm going to sleep
good night00:13
* bonniot leaves
* arjanb leaves00:42