Trying out the Fan-to-Javascript served from Wisp, I know it's experimental but it's cool so I'm trying it out. Seem to have found a bug; an ititializer like this (in Fan):
Basically, allow direct type referencing, allow methods directly on the objects, just use raw functions (at least for common sys methods that you know won't abuse the function, ... or can an anonymous function reference itself in Fan?). I tweaked a couple of other things there, too.
I debate fan.sys.List vs. just sys.List, but in the end, I agree with the cleaner namespace. Some facet to generate top level for a pod could be nice, though.
Just some thoughts.
andyFri 18 Sep 2009
Promoted to ticket #749 and assigned to andy
andyFri 18 Sep 2009
@tom - I'm not sure we'll see that level of parity with JavaScript (at least right now) - its very important to have a solid type system implementation in JavaScript - since alot of code relies on it. That was a mistake I made early on. It comes at the expense of being to work with Fan-Js naturally - but its necessary for Fan to run well in a jsvm.
There is still alot of room for improvement/optimization though (can count a few that are easy in KevinKelley's code). Type lookups in particular have been at the top of my list for sometime - but since they currently work, I've left them as is. They will eventually be just a field reference like we do in Java/C#:
fan.sys.List.make(fan.sudoku.DlxNode.$type);
But there is a chicken and egg problem in the sys library I need to sort through to make sure classes, static initializers/fields, and type info get parsed in the correct order.
andyFri 18 Sep 2009
Renamed from compilerJs bug in multi-dim list initializer to compilerJs bug in list initializer
andyFri 18 Sep 2009
The root issue here is that List.size is not properly implemented in the sys library and the compiler. I plan to move Lists to a wrapper object instead of a native JavaScript array, which will solve this issue (and a host of others like it).
KevinKelleyFri 18 Sep 2009
a solid type system implementation in JavaScript
+1 on that; it seems to me that this is going to end up being one of Fan's really big wins, if you can develop in Fan with type safety and then emit JS to run.
Side question ( Seaside question actually) -- you familiar with the Seaside webapp framework? Would be interesting to see something like it in Fan. I've only experimented a little with it, but I really like what I've seen.
andyFri 18 Sep 2009
Seaside webapp framework
I looked at it a few years ago. The big thing I recall was it was based on continuations, which was much easier to implement in Smalltalk than in the JVM. But ignoring performance and implementation issues, the model is undoubtedly easier and more natural to program against.
tompalmerFri 18 Sep 2009
Thanks for the feedback on issues.
andyTue 29 Dec 2009
Ticket resolved in 1.0.49
Root syntax bug fixed, so above code should compile/execute.
KevinKelley Fri 18 Sep 2009
Trying out the Fan-to-Javascript served from Wisp, I know it's experimental but it's cool so I'm trying it out. Seem to have found a bug; an ititializer like this (in Fan):
generates javascript like this:
which doesn't surprise me, just wanted to get it logged.
tompalmer Fri 18 Sep 2009
By the way (on the generation topic, not in relation to the bug), what I'd love to see is this (or something like it):
Basically, allow direct type referencing, allow methods directly on the objects, just use raw functions (at least for common sys methods that you know won't abuse the function, ... or can an anonymous function reference itself in Fan?). I tweaked a couple of other things there, too.
I debate
fan.sys.List
vs. justsys.List
, but in the end, I agree with the cleaner namespace. Some facet to generate top level for a pod could be nice, though.Just some thoughts.
andy Fri 18 Sep 2009
Promoted to ticket #749 and assigned to andy
andy Fri 18 Sep 2009
@tom - I'm not sure we'll see that level of parity with JavaScript (at least right now) - its very important to have a solid type system implementation in JavaScript - since alot of code relies on it. That was a mistake I made early on. It comes at the expense of being to work with Fan-Js naturally - but its necessary for Fan to run well in a jsvm.
There is still alot of room for improvement/optimization though (can count a few that are easy in KevinKelley's code). Type lookups in particular have been at the top of my list for sometime - but since they currently work, I've left them as is. They will eventually be just a field reference like we do in Java/C#:
But there is a chicken and egg problem in the sys library I need to sort through to make sure classes, static initializers/fields, and type info get parsed in the correct order.
andy Fri 18 Sep 2009
Renamed from compilerJs bug in multi-dim list initializer to compilerJs bug in list initializer
andy Fri 18 Sep 2009
The root issue here is that
List.size
is not properly implemented in the sys library and the compiler. I plan to move Lists to a wrapper object instead of a native JavaScript array, which will solve this issue (and a host of others like it).KevinKelley Fri 18 Sep 2009
+1 on that; it seems to me that this is going to end up being one of Fan's really big wins, if you can develop in Fan with type safety and then emit JS to run.
Side question ( Seaside question actually) -- you familiar with the Seaside webapp framework? Would be interesting to see something like it in Fan. I've only experimented a little with it, but I really like what I've seen.
andy Fri 18 Sep 2009
I looked at it a few years ago. The big thing I recall was it was based on continuations, which was much easier to implement in Smalltalk than in the JVM. But ignoring performance and implementation issues, the model is undoubtedly easier and more natural to program against.
tompalmer Fri 18 Sep 2009
Thanks for the feedback on issues.
andy Tue 29 Dec 2009
Ticket resolved in 1.0.49
Root syntax bug fixed, so above code should compile/execute.