Visage Compiler Preview 1

16 views
Skip to first unread message

Stephen Chin

unread,
Oct 18, 2010, 1:20:51 AM10/18/10
to visag...@googlegroups.com, visage...@googlegroups.com
I finished the implementation of default properties, and have posted a preview release of the compiler to get some feedback:
http://code.google.com/p/visage/downloads/list
Instructions on overlaying this on top of a JavaFX 1.3.1 install are here:
http://code.google.com/p/visage/wiki/InstallingPreviewBuilds

So why do default properties matter?  It makes the trivial case for a lot of objects much simpler, and greatly increases the readability of your Visage code.
For example, the following JavaFX code:
Stage {
  scene: Scene {
    contents: Rectangle {
      width: 100
      height: 100
    }
  }
}

Simplifies to the following in Visage:
Stage {
  Scene {
    Rectangle {
      width: 100
      height: 100
    }
  }
}

Note: The JavaFX libraries lack default property declarations so you would get some friendly compiler errors.  However, if you created some simple subclasses of the built-in classes and override the variables declaring them as "default", then you could do this.

Please give this feature a try and let me know what you think.  Also, if you find any bugs or run into issues, please discuss them on the mailing list or file an issue:
http://code.google.com/p/visage/issues/list

Just in case you are wondering, this particular change is binary compatible with old JavaFX releases, and the generated class files will work on the stock JavaFX 1.3.1 libraries so you are not introducing any dependencies on Visage (yet).  The only source incompatibility will be if you use the keywords "default" or "cascade" in your program, which have been added to the reserved words.

For more details about the exact syntax and semantics of this feature, please see the wiki entry on default properties:
http://code.google.com/p/visage/wiki/DefaultProperties

Cheers,
--
--Steve
blog: http://steveonjava.com/

Josh Marinacci

unread,
Oct 18, 2010, 12:01:00 PM10/18/10
to visage...@googlegroups.com, visag...@googlegroups.com
wow, that's very exciting. How difficult was this to add?

-j
Blasting forth in three part harmony!

Stephen Chin

unread,
Oct 18, 2010, 8:56:11 PM10/18/10
to visage...@googlegroups.com
It was not that hard...  Since I was learning I did it in 3 passes:
  1. Modified the grammar to support the default keyword on variables.  It is similar to other modifiers like public-init, so I modeled it after this to find all the places I needed to hit (even though I didn't quite understand why I needed all these changes yet).
  2. Added in support for anonymous expression blocks.  This is the part where you can omit the usual variable label.  The parser change was fairly easy and worked out of the box with some annoying warnings.  I was able to tweak the grammar to be unambiguous with a little extra work.  The backend work to lookup the default variable was a little more involved, but there is a pretty clean AST and model for how everything works so I was able to fit it in to the current design.
  3. Testing and documentation.  Lots of corner cases for superclasses, missing defaults, duplicate default declarations, etc. that exposed bugs in my code.  I added a suite of positive and negative test cases for everything I could think of, but am hoping folks will try the feature and do things I didn't think of to test it further.
Here are the changelists in case you are curious:
Part 1: http://code.google.com/p/visage/source/detail?r=3c544fbdc09442a27bad8e80f742866005c03542
Parts 2 and 3: http://code.google.com/p/visage/source/detail?r=f8519cadae8360d14dc9ef92957384c67e3d8315

The diffs are not as clean as I would like, because I could not restrain myself from fixing typos (someone needs a spell checker) and converting some tabs to spaces as I went along...

Cheers,
--Steve

Jo Voordeckers

unread,
Oct 19, 2010, 1:44:08 AM10/19/10
to visage...@googlegroups.com
Nice work Stephen! 

I'm looking forward to spending some time learning from your changesets in the next couple of days. :)

Regards,

Jo
--
- Jo

Fernando Martines

unread,
Oct 19, 2010, 5:45:30 AM10/19/10
to visage...@googlegroups.com
Great news Steve!

I think it would be useful if we have an automated test suite for basic checking purpose. The same test cases could be performed massively for Regression purpose as well. Since issues/defects can be reported and CRs addressed to solve those, automated testing is a good way.

I suggest (although not able to measure how much effort it would be required right now) we build, at least, a basic test suite based on JUnit only to make sure that everything is fine (unit test level firstly), and maybe a Continuous Integration environment very soon.

I can spend some effort on this if you guys cogitate that it could be helpful for the Visage project.

Regards,
~Fernando Martines


2010/10/18 Stephen Chin <st...@widgetfx.org>

Stephen Chin

unread,
Oct 19, 2010, 6:02:14 AM10/19/10
to visage...@googlegroups.com
Fernando,

There is already a test suite with several thousand tests (and a handful more that I added to check default properties).  I have been manually running these prior to check-in (they are all passing right now).

All the infrastructure is in place to have a continuous build setup on a Hudson server, we just need a donor to supply the hardware to run on.

If you would like to volunteer to setup the continuous integration build, that would be a big help.

Cheers,
--Steve

jos...@marinacci.org

unread,
Oct 19, 2010, 10:25:53 AM10/19/10
to visage...@googlegroups.com
We can use my server.



-- Sent from my Palm Pre on Verizon Wireless


Fernando Martines

unread,
Oct 20, 2010, 5:40:57 AM10/20/10
to visage...@googlegroups.com
Hello Steve,

I´ve been trying to contact some people who could provide a dedicated server for this purpose. However, are you planning to use Hudson solely? I´ve been testing the Apache Continuum for a couple of weeks and have been happy with the results.

http://continuum.apache.org/
http://en.wikipedia.org/wiki/Apache_Continuum
Live Demo: http://vmbuild.apache.org/continuum/groupSummary.action

I suppose that the choice about which CI tools we could use is not the main discussion, indeed. Anyway, I keep you informed about that possible server.

Hi Joshua,
Could you provide us more information about your server?
 
BRs,
~Fernando

Stephen Chin

unread,
Oct 20, 2010, 7:51:11 AM10/20/10
to visage...@googlegroups.com
The build is setup to use Hudson already, which is what the JavaFX Compiler team used.  Other than the fact that Kohsuke Is The Man!™, I have no allegiance to Hudson other than status quo/expediency.

I would work with Josh to see if you can use his server and get us setup quickly.

Cheers,
--Steve

jos...@marinacci.org

unread,
Oct 20, 2010, 10:57:01 AM10/20/10
to visage...@googlegroups.com
I have a virtual linux box that I use for Hudson for LeonardoSketch.org and to run a couple of wordpress blogs. I could give someone admin access to my hudson install to set up jobs for Visage.




-- Sent from my Palm Pre on Verizon Wireless

Fernando Martines

unread,
Oct 21, 2010, 3:11:16 PM10/21/10
to visage...@googlegroups.com
Hello Joshua.

I am just waiting for reply from a big hosting provider who perhaps could be an honorary donor.
I was in contact with them in a couple of hours ago to study the possibilities.
Since I get some news or even a definitive position from them, I think we can trigger your server.

Thanks in advance.
~Fernando

Josh Marinacci

unread,
Oct 25, 2010, 12:48:17 PM10/25/10
to visage...@googlegroups.com
sure. let me know what you find out.
Reply all
Reply to author
Forward
0 new messages