--
Arthur Kalmenson
I am impressed, the project looks highly non trivial, my main problem with GWT is it's verbosity
and non declarativeness for defining UIs (unless you use XML, but that is too big of a
price to pay in my opinion), your project has the potential to allow the definition of GWT UIs
that are both declarative *and* strongly typed....
Keep up the awesome work !
val b = new Button("Click me", (_: ClickEvent) => Window.alert("Hello, AJAX, said Scala\nThose numbers are coming from list!\n" + s));
implicit def clickHandler(f: ClickEvent => Unit): ClickHandler = new ClickHandler {def onClick(event: ClickEvent) = f(event)}
Seriously. The potential is immense, though so is the remaining work
:-( Grzegorz, you should come over for Google I/O in May! I would
love to at least see/hear an Ignite talk on your experience so far,
and maybe try to schedule a little hackathon. If it fits with your
academic calendar, and people have interest, I would be happy to try
to help drum up donations to get you transported.
That implicit looks like the one from the Showcase (which will hopefully make it into some library where it can be reused). There probably should be another one to handle the (fairly common, I think) case in which the event is ignored:implicit def clickHandler2(thunk: => Unit): ClickHandler = new ClickHandler {def onClick(event: ClickEvent) = thunk}
Hi,I thought you'd be pleased to see following code:class Hello extends EntryPoint {def onModuleLoad() {val numbers = List(1, 2, 3, 4)val strings = numbers map (_.toString + "...")val s = strings mkString ","val b = new Button("Click me", (_: ClickEvent) => Window.alert("Hello, AJAX, said Scala\nThose numbers are coming from list!\n" + s));RootPanel.get().add(b);}implicit def clickHandler(f: ClickEvent => Unit): ClickHandler = new ClickHandler {def onClick(event: ClickEvent) = f(event)}}and screenshot (attached) showing this stuff works.
Hi,I thought you'd be pleased to see following code:class Hello extends EntryPoint {def onModuleLoad() {val numbers = List(1, 2, 3, 4)val strings = numbers map (_.toString + "...")val s = strings mkString ","val b = new Button("Click me", (_: ClickEvent) => Window.alert("Hello, AJAX, said Scala\nThose numbers are coming from list!\n" + s));RootPanel.get().add(b);}implicit def clickHandler(f: ClickEvent => Unit): ClickHandler = new ClickHandler {def onClick(event: ClickEvent) = f(event)}}
all the best,
Johann
git clone http://review.source.gogoego.com/p/projects/scalagwt-sample
cd scalagwt-sample
git fetch http://review.source.gogoego.com/p/projects/scalagwt-sample
refs/changes/20/2120/1 && git checkout FETCH_HEAD
and then I run `ant` and `ant devmode` after each modification.
===
I got an error from ant devmode:
devmode:
[java] Unknown argument: -draftCompile
The devmode target seemed to use gwtc-specific arguments unknown to
DevMode, I commented (line 74) <arg line="${gwt.args}"/> out, to get
things running.
===
So far the most severe problem I encountered is that basic pattern
matching on `Int` doesn't work:
def tMatch0(i:Int) : Unit = i match {
case 0 => trace("tm 0")
case 1 => trace("tm 1")
case 2 => trace("tm 2")
case _ => trace("tm _")
}
produces this in the resulting JS:
function $tMatch0(i){
var temp1;
temp1 = i;
temp1;
}
I tried several variations, and matching `Int`s never worked.
OTOH, I had no obvious problems with pattern matching with case classes,
both my own and Option[T]s Some/None.
Another thing I noticed is that .toString in some cases is not
implemented, but I'm sure you're aware of that.
regards,
Johann
On 02/28/2011 04:31 PM, Grzegorz Kossakowski wrote:Nice, first let's make sure I set things up correctly, these were the steps I took:
Let's start with few examples and I'll let you if I knew them before or this is something completely new to me.
git clone http://review.source.gogoego.com/p/projects/scalagwt-sample
cd scalagwt-sample
git fetch http://review.source.gogoego.com/p/projects/scalagwt-sample refs/changes/20/2120/1 && git checkout FETCH_HEAD
and then I run `ant` and `ant devmode` after each modification.
===
I got an error from ant devmode:
devmode:
[java] Unknown argument: -draftCompile
The devmode target seemed to use gwtc-specific arguments unknown to DevMode, I commented (line 74) <arg line="${gwt.args}"/> out, to get things running.
===
So far the most severe problem I encountered is that basic pattern matching on `Int` doesn't work:
def tMatch0(i:Int) : Unit = i match {
case 0 => trace("tm 0")
case 1 => trace("tm 1")
case 2 => trace("tm 2")
case _ => trace("tm _")
}
produces this in the resulting JS:
function $tMatch0(i){
var temp1;
temp1 = i;
temp1;
}
I tried several variations, and matching `Int`s never worked.
OTOH, I had no obvious problems with pattern matching with case classes, both my own and Option[T]s Some/None.
Another thing I noticed is that .toString in some cases is not implemented, but I'm sure you're aware of that.
That looks like the discarded LabelDef problem that Grzegorz put in a
patch for over the weekend. The pattern-matching code has simply
disappeared.
Lex
Oh, I just realized you posted JavaScript there, not Jribble. Do you
think you can dig out the Jribble file that is created for your
example? -Lex
Yep, that would be very helpful. I believe that sample is using latest version of a compiler but I could mess up something.
Of course, this is the resulting jribble for that function:
> I'd love to hear about toString issue, too.
>
to reproduce this, simply put
trace(numbers.toString)
in onModuleLoad(), the Exception is this:
Uncaught TypeError: Object List(1, 2, 3, 4) has no method 'toString_1'
which is somewhat funny, since it very much looks like there *is* a
working toString somewhere.
Thanks a lot!
regards,
Johann
On 02/28/2011 08:27 PM, Grzegorz Kossakowski wrote:
Again, wow, the magic of open source: report a bug and have it fixed a negligible amount of minutes later :) . Now I think I have all the preliminaries to start rewriting an existing project that'll put quite some of Scalas language features into use, I'm optimistic that I'll be able to help identify more problems ( if any ;) ) in the course of it.
to reproduce this, simply put
trace(numbers.toString)
in onModuleLoad(), the Exception is this:
Uncaught TypeError: Object List(1, 2, 3, 4) has no method 'toString_1'
which is somewhat funny, since it very much looks like there *is* a working toString somewhere.
You know what would be a huge help for me? If you built a single jar that would just, zap, turn all the Scala code into Javascript. Like this:$ java -jar scalagwt.0.8.jar -o myprogram.js FirstThing.scala SecondThing.scalaSomething like that.
regards,
Johann
On 02/28/2011 09:48 PM, Grzegorz Kossakowski wrote:
Yep, if you have any preferences WRT the format of the examples (methods/classes/modified-hello-example-file/other), let me know.
I'm sure you'll find lots of problems but reports with reproducible examples would be a huge help. [..]
While you have a good long list of bugs, that's a good idea, of course, but once you get that whittled down, my honest (if not disinterested) advice would be make it convenient for people like me -- who have no knowledge of, or interest in, things like Jribble or ASTs or compiler design -- to actually try it out, because we represent your audience, the vast majority who really need your product without necessarily understanding it.
Let me propose two (wholly hypothetical) bugs:1. the compiler doesn't handle eta expansion inside a comprehension2. the compiled code cannot call document.createElement when run in a browserThe first bug (if it were to exist) would I think be noticed, discussed, and fixed by the kind of people who want to download and build the whole Scala-GWT package; the second bug would be something kind of minor that would nonetheless make Scala-GWT pretty useless to the average programmer.