[prev in list] [next in list] [prev in thread] [next in thread]
List: groovy-user
Subject: Re: [groovy-user] Classes , imports, etc.
From: Guillaume Laforge <glaforge () codehaus ! org>
Date: 2013-04-21 18:22:01
Message-ID: CAJ2HCd_vOL2YoUHE5A9YCVhn-+0gm2tx2pJGhZReesw=T6bdvQ () mail ! gmail ! com
[Download RAW message or body]
You could always do the following inside your loop:
def x = (it as Class).newInstance()
Guillaume
On Sun, Apr 21, 2013 at 3:30 PM, Russel Winder <russel@winder.org.uk> wrote:
> This probably seems like a "Dear lazyweb," but if anyone does have any
> thoughts that would be great…
>
> It strikes me that a dynamic language on the JVM should be able to do
> something along the lines of:
>
> {'a.b.c', 'f.y.z.r', 'd.d.d'}.each{
> import it
> def x = new it()
> …
> }
>
> But I am beginning the thing that this is not possible in Groovy (or
> Java, JRuby, Clojure, Scala?) whereas it is possible on the PVM with
> Python. Mayhap Jython can, which means mayhap JRuby and Clojure can?
>
> --
> Russel.
>
> =============================================================================
> Dr Russel Winder t: +44 20 7585 2200 voip:
> sip:russel.winder@ekiga.net
> 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk
> London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
>
--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
[Attachment #3 (text/html)]
<div dir="ltr">You could always do the following inside your loop:<div><br></div><div \
style>def x = (it as Class).newInstance()</div><div style><br></div><div \
style>Guillaume</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"> \
On Sun, Apr 21, 2013 at 3:30 PM, Russel Winder <span dir="ltr"><<a \
href="mailto:russel@winder.org.uk" \
target="_blank">russel@winder.org.uk</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> This probably seems like a "Dear lazyweb," but if \
anyone does have any<br> thoughts that would be great…<br>
<br>
It strikes me that a dynamic language on the JVM should be able to do<br>
something along the lines of:<br>
<br>
{'a.b.c', 'f.y.z.r', 'd.d.d'}.each{<br>
import it<br>
def x = new it()<br>
…<br>
}<br>
<br>
But I am beginning the thing that this is not possible in Groovy (or<br>
Java, JRuby, Clojure, Scala?) whereas it is possible on the PVM with<br>
Python. Mayhap Jython can, which means mayhap JRuby and Clojure can?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Russel.<br>
=============================================================================<br>
Dr Russel Winder t: <a href="tel:%2B44%2020%207585%202200" \
value="+442075852200">+44 20 7585 2200</a> voip: <a \
href="mailto:sip%3Arussel.winder@ekiga.net">sip:russel.winder@ekiga.net</a><br> 41 \
Buckmaster Road m: <a href="tel:%2B44%207770%20465%20077" \
value="+447770465077">+44 7770 465 077</a> xmpp: <a \
href="mailto:russel@winder.org.uk">russel@winder.org.uk</a><br> London SW11 1EN, UK \
w: <a href="http://www.russel.org.uk" target="_blank">www.russel.org.uk</a> skype: \
russel_winder<br> </font></span></blockquote></div><br><br \
clear="all"><div><br></div>-- <br>Guillaume Laforge<br>Groovy Project Manager<br>Head \
of Groovy Development at SpringSource<br><a href="http://www.springsource.com/g2one" \
target="_blank">http://www.springsource.com/g2one</a> </div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic