Open TiarkRompf opened 12 years ago
One point to keep in mind about repProxy
is that method calls to a proxied value are always considered to be effectful (which disables some possible optimizations when the method is actually side effect free).
Maybe we need to let the developer describe the possible effects of each method call of a proxied value (but that would require more effort from the developer…).
Good point. I see repProxy
more as a stepping stone though, something to start out with because it's convenient, and later you can switch to custom IR nodes when and if you need better optimization. We could think about having annotations on methods (like @pure
).
Hi,
FYI, here are some features that are in js-scala and for which I’d like to have your feedback:
q"$xs.mkString($sep)"
instead of quote(xs) + ".mkString(" + quote(sep) + ")"
. But I think you introduced something like this, or even more evolved, in LMS, no?List
;Option
.Hi Julien, this sounds pretty cool.
@Lewix also implemented some string interpolation support (https://github.com/TiarkRompf/virtualization-lms-core/pull/69); it would be nice to compare.
For ADTs, I'm thinking this could be an alternative for explicit case class support in Scala-Virtualized. Could the constructor and member definition be auto-generated (i.e. remove the implicit def pointOps(p: Rep[Point]) = adtOps(p)
line)? I guess this is where you would use macros annotations? Another option might be the 'poor mans type providers' based on Dynamic
.
@kjbrown: do you think this ADT impl would be useful for Delite?
Could the constructor and member definition be auto-generated (i.e. remove the implicit def pointOps(p: Rep[Point]) = adtOps(p) line)?
Yes, if I use a macro annotation instead of the current def macro we can get rid of both the implicit def pointOps
and the val Point
(the macro expansion would generate everything needed in the companion object).
The string interpolation I wrote works in much the same way, by looking at the type of each argument. It has a few more bells and whistles like remapping manifests, emitting blocks and printing the string to the output stream. The code is here.
Cool, so I think I will switch to your implementation :)
Oh, I forgot but I tried to implement a kind of module generator (generated JavaScript code is here): instead of generating a program we generate an object exposing several methods (or sub-modules).
There are still things to improve: each exported function is generated independently of others, so they can not benefit from common subexpressions elimination between functions. The DSL-like API to define a module is a bit too much verbose.
I would be happy to get your feedback on this :)
I'm mostly thinking about generic things like
repProxy
or class lifting but it would be good to discuss to which extent other stable pieces of js-scala can and should be integrated. cc: @namin,@julienrf