Re: An Eiffel to javascript compiler?
Paul Cohen <[email protected]> Fri, 15 Jan 2010 10:19:14 +0100
| Newsgroups | gmane.comp.lang.eiffel.gobo.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, 2010/1/15 Cheng-Chang Wu <chengchangwu-/[email protected]> > I'm inspired by GWT but I haven't used it. > I'm not talking about Client-Side Javascript;) Aha. > At my work I am using SmartEiffel and javascript. Because SmartEiffel is > dead, I decide to port my work to gec next year. I'm rethinking the > structure of my work, that's why the Eiffel-to-javascript exercise. Ok. > > 3. It's a good idea to allow users to mix handwritten JavaScript with > > the Eiffel source code, > Yes, this seems something very desirable. Could you give an example > program to explain what you really mean? I was thinking primarily from the perspective of Client-Side Javascript where it would allow you to focus on the compiler issues but allow you to reuse existing JavaScript toolkits/libraries for UI widgets. I still think it is a good idea even if you're not primarly targeting Client-Side JavaScript, because it will allow you to reuse existing JavaScript libraries. I don't have any well-thought out solution but I would look at using the Eiffel external mechanism. Here's an example of how a JavaScript function called 'foo' in the file 'bar.js' could be handled. js_foo_bar (a: INTEGER): BOOLEAN is -- Invoke the JavaScript function foo in JavaScript library bar external "JavaScript (number): boolean | <bar.js>" alias "foo" end See section 8.31 (Interfacing with C, C++ and other environments) in the Eiffel specification (http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-367.pdf) for more details on the external clause. Since JavaScript is an untyped, or loosely typed, language you will need to adress that issue in implementing the above solution (I use the standard names for JavaScript types in the example above). Note that the file 'bar.js' could be part of an external JavaScript library or simply be a piece of JavaScript code written by the same developer who is writing the Eiffel code. Concerning conversion between Eiffel and JSON values you could look at eJSON: http://ejson.origo.ethz.ch /Paul -- Paul Cohen www.seibostudios.se mobile: +46 730 787 035 e-mail: paul.cohen-qf2BM/[email protected] ------------------------------------ To Post a message, send it to: [email protected] To Unsubscribe, send a blank message to: [email protected]! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/gobo-eiffel/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/gobo-eiffel/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/