List Info

Thread: Java Binding




Java Binding
country flaguser name
United States
2007-06-05 01:00:45
OK, here goes.  I never did find out if this is still the
proper place 
to submit stuff like this, so I'll assume it is.  I guess
I'll give it a 
couple weeks and repost on devel if it doesn't get any
traction here.

As the subject states, I'm interested in a Java language
binding.  I've 
read up as much as I can follow on this list (in particular,
the 
Java/JNI sub-thread off of the Ruby discussions), and I've
read the 
following documents:

http://www.boost-consulting.com/writing/oopsla04.html
http://www.boost-consulting.com/writing/langbinding.ppt
Extreme_Object_Models_Using_Boost.Python.pdf (from
BoostCon)

The last one got me really excited.  This is *exactly* how I
like to use 
JNI currently (at my workplace), but I basically do this by
hand, along 
with a wrapper library that I created to help with the
process.

So I'll get to the point.  I would love to see a Boost.Java,
but I know 
that Dave and Daniel have been drawn away from the project
by other 
(very important) concerns.  I would like to help in any way
that I can. 
  I have a good amount of JNI experience, and I think I'm
qualified to 
at least do some of the grunt work.

Now, I understand that doing a langbinding-related binding
for Java may 
not be in the cards.  I wasn't even able to find any
langbinding source; 
it's been deleted from the Sourceforge tree, and it's not in
the SVN 
tree or the Boost File Vault.  Does it exist anywhere?  I'd
love to at 
least play with it.

Even if this isn't possible at this time, I think that a
Java binding 
would be beneficial to the community.  JNI is notoriously
difficult to 
wrangle, and a high-class C++ binding would be appreciated
by quite a 
few, especially if it were to come from Boost.  There are
other bindings 
out there, but I like the style of interface offered by
Boost.Python and 
Luabind, and having something similar (that is, would have a
similar 
interface to these others) I view as advantageous.

So, to sum up, I have a few (ok, many) questions:

1.  Is Langbinding something that will return in the near
future?  That 
is, is there still interest in pursuing the project?  (I
understand that 
this is a hard question to answer.)

2.  If so, I know that it wouldn't be as dynamic as the
Python or Lua 
bindings, but is a generated Java source file something that
could be 
accepted, at least in the near term?  I know that there were
discussions 
about special class loaders and such, but doing that would
probably be 
out of my depth (at least right now; Java bytecode is
something that I 
intend to study in the future).  However, I envision an
interface 
whereby you could query a module for its Java source, or you
could maybe 
adapt it to generate a class file on the fly, or maybe even
something 
more sophisticated.  It should be possible to abstract
something like this.

In fact, now that I think about it, there are methods to
define a class 
file from a byte stream in ClassLoader (it's called
defineClass, in 
fact).  You could maybe have a native method for a class
that's always 
available, temporarily rebind it to an implementation
defined in the 
module, and that module calls something that produces the
byte array 
full of bytecode necessary for calling the class-definition
method.  I'm 
probably getting way ahead of myself, though, and I don't
even know if 
that would work.

3.  If Langbinding is more of a long-term return goal, or it
has been 
shelved permanently, would creating a Java binding be a
worthy effort? 
There are many such efforts out there; does it have a place
in Boost? 
If so, should it look like Boost.Python or Luabind?  Should
it have its 
own identity?  Would it be advantageous to try to code it to
the 
Langbinding interface, so that it could be adapted were
Langbinding to 
be revived?

Regardless of the answers to these questions, I think that
I'll try to 
at least invent something that aspires to be a Boost.Java,
even if I 
don't ever submit it.  

Thanks for giving me your attention, I'm looking forward to
your replies.

-- 

John Moeller
fishcorngmail.com


------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Boost-langbinding mailing list
Boost-langbindinglists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/boost
-langbinding

Re: Java Binding
country flaguser name
United States
2007-06-05 09:07:31
John Moeller wrote:
> OK, here goes.  I never did find out if this is still
the proper place 
> to submit stuff like this, so I'll assume it is.  I
guess I'll give it a 
> couple weeks and repost on devel if it doesn't get any
traction here.

Yea, still the place for this 

> Now, I understand that doing a langbinding-related
binding for Java may 
> not be in the cards. 

It's in the cards if you are willing to make it happen 

> I wasn't even able to find any langbinding source; 
> it's been deleted from the Sourceforge tree, and it's
not in the SVN 
> tree or the Boost File Vault.  Does it exist anywhere? 
I'd love to at 
> least play with it.

It's in the HEAD CVS under the "langbinding"
branch. You can get the two 
individual dirs for it:

http://boost.cvs.sourceforge.
net/boost/boost/boost/langbinding/?pathrev=langbinding
http://boost.cvs.sourceforge.n
et/boost/boost/libs/langbinding/?pathrev=langbinding

> Even if this isn't possible at this time, I think that
a Java binding 
> would be beneficial to the community. 

It would. And I mentioned it as an idea long ago now. One of
the big 
problems with a Java binding is JNI itself. Since JNI works
on link 
symbol names it's still an open question of if it's possible
to make it 
work with arbitrary function pointers, or function objects.

> So, to sum up, I have a few (ok, many) questions:
> 
> 1.  Is Langbinding something that will return in the
near future?  That 
> is, is there still interest in pursuing the project? 
(I understand that 
> this is a hard question to answer.)

There is interest. It's just not high enough priority.

> 2.  If so, I know that it wouldn't be as dynamic as the
Python or Lua 
> bindings, but is a generated Java source file something
that could be 
> accepted, at least in the near term?

Sure, gota start somewhere.

> In fact, now that I think about it, there are methods
to define a class 
> file from a byte stream in ClassLoader (it's called
defineClass, in 
> fact).  You could maybe have a native method for a
class that's always 
> available, temporarily rebind it to an implementation
defined in the 
> module, and that module calls something that produces
the byte array 
> full of bytecode necessary for calling the
class-definition method.  I'm 
> probably getting way ahead of myself, though, and I
don't even know if 
> that would work.

Hm, interesting... The one other idea I had was to have the
C++ side 
generate dynamic symbols at load time. But that sounds way
harder now 
than doing a custom ClassLoader.

> 3.  If Langbinding is more of a long-term return goal,
or it has been 
> shelved permanently, would creating a Java binding be a
worthy effort? 

Yes, it would be worth it.

> There are many such efforts out there; does it have a
place in Boost? 

Yes.

> If so, should it look like Boost.Python or Luabind? 
Should it have its 
> own identity?  Would it be advantageous to try to code
it to the 
> Langbinding interface, so that it could be adapted were
Langbinding to 
> be revived?

Hm, good questions. I personally would like to see more work
done on 
Langbinding. But I won't cry if you don't work with it.

> Regardless of the answers to these questions, I think
that I'll try to 
> at least invent something that aspires to be a
Boost.Java, even if I 
> don't ever submit it.  

Cool. Look forward to seeing the results.



-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software
.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Boost-langbinding mailing list
Boost-langbindinglists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/boost
-langbinding

Re: Java Binding
country flaguser name
United States
2007-06-05 10:41:54
Rene Rivera wrote:
> John Moeller wrote:
>> OK, here goes.  I never did find out if this is
still the proper place 
>> to submit stuff like this, so I'll assume it is.  I
guess I'll give it a 
>> couple weeks and repost on devel if it doesn't get
any traction here.
> 
> Yea, still the place for this 

Cool.  Thanks for replying so quickly.

> It's in the cards if you are willing to make it happen


Whew.  Ok, I have to admit that I'm a bit nervous now.    This is a

project that I think that I could definitely get behind;
I'll give it my 
best shot.

> It's in the HEAD CVS under the "langbinding"
branch. You can get the two 
> individual dirs for it:
> 
> http://boost.cvs.sourceforge.
net/boost/boost/boost/langbinding/?pathrev=langbinding
> http://boost.cvs.sourceforge.n
et/boost/boost/libs/langbinding/?pathrev=langbinding

Aha.  Ok, I didn't notice the "show dead files"
link.  Does that mean 
that they are still available to get through CVS?  I have to
admit that 
it's been several years since I used CVS, and I wouldn't
know how to 
retrieve them.  That is, I don't know what "dead"
means in the CVS 
source browser.  Does that mean that they've been deleted
from the 
repository, and these are the versions that existed before? 
Would I 
just be retrieving a particular version of each file, or is
there a tag 
that exists right before the files were killed?  Oh, and do
I need 
access to CVS for this or is there anonymous access?

> It would. And I mentioned it as an idea long ago now.
One of the big 
> problems with a Java binding is JNI itself. Since JNI
works on link 
> symbol names it's still an open question of if it's
possible to make it 
> work with arbitrary function pointers, or function
objects.

Hrm.  Yeah, this may be the hardest part (aside from getting
it to 
actually interface with Java).  What I ended up doing (for
native-to- 
Java calls) in the toolkit I wrote was to create a system
whereby the 
call was constructed from the arguments themselves.  I
collected 
signature elements from the arguments as I got them in, and
I generated 
the signature upon calling the function.  I don't know if
this would be 
something that would fit the interface at all, but there may
be 
something similar I could do.

I'd appreciate any function(al)-introspection ideas you
have.

> There is interest. It's just not high enough priority.

That's good to hear, at least.

>> In fact, now that I think about it, there are
methods to define a class 
>> file from a byte stream in ClassLoader (it's called
defineClass, in 
>> fact).  You could maybe have a native method for a
class that's always 
>> available, temporarily rebind it to an
implementation defined in the 
>> module, and that module calls something that
produces the byte array 
>> full of bytecode necessary for calling the
class-definition method.  I'm 
>> probably getting way ahead of myself, though, and I
don't even know if 
>> that would work.
> 
> Hm, interesting... The one other idea I had was to have
the C++ side 
> generate dynamic symbols at load time. But that sounds
way harder now 
> than doing a custom ClassLoader.

Oh, is this what you meant by a custom ClassLoader?  I was
just thinking 
to use the base class; the functionality seems to exist in
there.  I'm 
glad that this is along the lines of what you were
thinking.

There's something scratching at the back of my mind about
class loaders; 
I seem to remember something about needing to be consistent
with them, 
like using the same one for loading different classes,
something like 
that.  But I don't recall what that is.  I could just be
crazy.

I agree with you about the difficulty of generating dynamic
symbols at 
load time.  Especially now with the hoops that you want to
jump through 
to generate code that works on Windows Vista.  Plus, it
would be good to 
offer similar functionality for Linux/Solaris DSO's as well,
and that 
increases the effort.

> Cool. Look forward to seeing the results.

I'll try to get started right away.  I've got work and home
to juggle 
along with this too, but I'm excited to get going.

-- 

John Moeller
fishcorngmail.com


------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Boost-langbinding mailing list
Boost-langbindinglists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/boost
-langbinding

Re: Java Binding
country flaguser name
United States
2007-06-06 00:03:00
John Moeller wrote:
> Aha.  Ok, I didn't notice the "show dead
files" link.  Does that mean 
> that they are still available to get through CVS?  I
have to admit that 
> it's been several years since I used CVS, and I
wouldn't know how to 
> retrieve them.  That is, I don't know what
"dead" means in the CVS 
> source browser.  Does that mean that they've been
deleted from the 
> repository, and these are the versions that existed
before?  Would I 
> just be retrieving a particular version of each file,
or is there a tag 
> that exists right before the files were killed?  Oh,
and do I need 
> access to CVS for this or is there anonymous access?

Nevermind, I figured out the "dead" situation. 
They're just old 
versions.  As for CVS access, I'll just try to figure this
one out on my 
own and let you know if I run into any trouble.

-- 

John Moeller
fishcorngmail.com


------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Boost-langbinding mailing list
Boost-langbindinglists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/boost
-langbinding

Re: Java Binding
country flaguser name
United States
2007-06-06 10:30:04
on Tue Jun 05 2007, John Moeller
<fishcorn-AT-gmail.com> wrote:

> Rene Rivera wrote:
>> John Moeller wrote:
>>> OK, here goes.  I never did find out if this is
still the proper place 
>>> to submit stuff like this, so I'll assume it
is.  I guess I'll give it a 
>>> couple weeks and repost on devel if it doesn't
get any traction here.
>> 
>> Yea, still the place for this 
>
> Cool.  Thanks for replying so quickly.
>
>> It's in the cards if you are willing to make it
happen 
>
> Whew.  Ok, I have to admit that I'm a bit nervous now. 
  This
is a 
> project that I think that I could definitely get
behind; I'll give it my 
> best shot.
>
>> It's in the HEAD CVS under the
"langbinding" branch. You can get the two 
>> individual dirs for it:
>> 
>> http://boost.cvs.sourceforge.
net/boost/boost/boost/langbinding/?pathrev=langbinding
>> http://boost.cvs.sourceforge.n
et/boost/boost/libs/langbinding/?pathrev=langbinding
>
> Aha.  Ok, I didn't notice the "show dead
files" link.  Does that mean 
> that they are still available to get through CVS?  I
have to admit that 
> it's been several years since I used CVS, and I
wouldn't know how to 
> retrieve them.  That is, I don't know what
"dead" means in the CVS 
> source browser.  Does that mean that they've been
deleted from the 
> repository, and these are the versions that existed
before?  

No, it just means they were only checked in on the
"langbinding"
branch, and never on HEAD.

> Would I just be retrieving a particular version of each
file, or is
> there a tag that exists right before the files were
killed?  Oh, and
> do I need access to CVS for this or is there anonymous
access?

Anonymous access will do.

at the root of your boost working copy,

   cvs up -r langbinding boost/langbinding libs/langbinding

-- 
Dave Abrahams
Boost Consulting
http://www.boost-cons
ulting.com


------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Boost-langbinding mailing list
Boost-langbindinglists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/boost
-langbinding

Re: Java Binding
country flaguser name
United States
2007-06-06 22:07:57
David Abrahams wrote:
>> Aha.  Ok, I didn't notice the "show dead
files" link.  Does that mean 
>> that they are still available to get through CVS? 
I have to admit that 
>> it's been several years since I used CVS, and I
wouldn't know how to 
>> retrieve them.  That is, I don't know what
"dead" means in the CVS 
>> source browser.  Does that mean that they've been
deleted from the 
>> repository, and these are the versions that existed
before?  
> 
> No, it just means they were only checked in on the
"langbinding"
> branch, and never on HEAD.

I see now.  Sorry for the noise.

>> Would I just be retrieving a particular version of
each file, or is
>> there a tag that exists right before the files were
killed?  Oh, and
>> do I need access to CVS for this or is there
anonymous access?
> 
> Anonymous access will do.
> 
> at the root of your boost working copy,
> 
>    cvs up -r langbinding boost/langbinding
libs/langbinding

This worked great.  Thank you very much.

It didn't build, until I figured out that I needed a
Jamfile.v2.  I 
based this one off of the one in boost/system:


project boost/langbinding
     : source-location ../src
     ;

SOURCES =
     backend/plugin
     backend/call_xxx_data
#    classes/holder
     classes/inheritance
     converter/registry
     module/id
     ;

lib boost_langbinding
    : $(SOURCES).cpp
    ;


Will this work?  Or will I need something more?

Thanks again,

-- 

John Moeller
fishcorngmail.com


------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Boost-langbinding mailing list
Boost-langbindinglists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/boost
-langbinding

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )