Builtin Builder Class

1 weergave
Naar het eerste ongelezen bericht

dreamhead

ongelezen,
24 jul 2007, 06:07:0924-07-2007
aan xruby...@googlegroups.com
Hi!

I got an inspiration from JRuby mailing list about Java 5. Since Java
5 is our language, we can use it more aggressively. We can use
annotation to mark which code is for builtin. My assumption is like
this.

@RubyBuiltin(name="Array")
public class RubyArray {
....

@RubyMethod(name="clear", type=NO_ARG)
public RubyArray clear() { ... }
}

Of course, Runtime will be changed to get the class. Maybe like this:
ArrayClass = ClassFactory.getClass(RubyArray.class);

Of course, we have to do some work to make it happen. I think the code
will look cleaner with this approach.
Do you like it? Any feedback is welcome!

Ye Zheng
--
Everything is simple!

Xue Yong Zhi

ongelezen,
24 jul 2007, 10:50:0824-07-2007
aan xruby...@googlegroups.com
If it makes code cleaner, then definitely worth a try.

_________________________________________________________________
http://liveearth.msn.com

femto gary

ongelezen,
24 jul 2007, 12:15:1124-07-2007
aan xruby...@googlegroups.com
Just like Ola Bini posts in the jruby mailing list,
most "enterprise" are still in 1.4, so moving to 1.5
is kind of radical here, anyway, not all companies
are all like TW taking the newest technology so radically.
take my company as an example, just finished transition from 1.3 to 1.4,
definitely won't use 1.5 in the near future. so moving to 1.5
would affect a lot of companies of choice to adopt XRuby.
anyway, I'm just holding my conservative views here.


--
Best Regards
XRuby http://xruby.com
femto http://hi.baidu.com/femto

dreamhead

ongelezen,
24 jul 2007, 21:50:0324-07-2007
aan xruby...@googlegroups.com
You're right! But XRuby starts with Java 5 which is different from
JRuby. We have applied many Java 5 features in our code, such as
generic, varargs etc.

On the other hand, I think most Java 5 features can be ported back on
Java 1.4 in bytecode level. The code generation is just used in
development which has no impact on deployment.

2007/7/25, femto gary <femt...@gmail.com>:


--
Everything is simple!

dreamhead

ongelezen,
29 jul 2007, 22:35:5929-07-2007
aan xruby...@googlegroups.com
I have finished the first version of this idea.

Here is a demo for test.
@RubyLevelClass(name="ClassFactory", modules="ClassFactoryModule")
public static class ClassFactoryValue extends RubyValue {
...

@RubyLevelMethod(name="test", type=MethodType.NO_ARG)
public RubyValue test() {
return RubyConstant.QNIL;
}
}

You can get the klass like this:
RubyClass klass = RubyTypeFactory.getClass(ClassFactoryValue.class);

I've applied this annotation on UnboundMethodClass. You will see the
code in RubyRuntime and RubyMethodValue.
UnboundMethodClass = RubyTypeFactory.getClass(RubyMethodValue.class);

I'll apply this idea more aggressively. :)

Ye Zheng


--
Everything is simple!

Allen beantwoorden
Auteur beantwoorden
Doorsturen
0 nieuwe berichten