Hi!

I have been working on a solution to be able to access cspace get/set
methods as language specific accessors (in my case python).

Ie, i want to be able to do:

movable.Position = somevector
somevector = movable.Position

instead of:
movable.SetPosition(somevector)
somevector = movable.GetPosition()

the main reasons are simplified (more natural) syntax and API.

So far together with Christopher Fraser i have made an analyzer that
finds all such methods and inferes properties, it has been under testing
for quite some time now (several months) and i think it is already
production ready (it shouldnt break any of older interface and most
get/set methods get wrapped as expected). Also the same generator can be
used on cel, and later it can be used to find and wrap other patterns
(like list like interfaces, or iterator interfaces) in language specific
ways.

Thing is there are two approaches how this can be used, either by
generating appropiate swig interface files (that also other languages
could use), or by generating a pure python module that introduces the
new syntax by importing it (like import csproperties).

The first approach (generating additional swig interface files) would
require some changes in cs build system so the generator is run before
swig, and can be considered more invasive. This approach could be a bit
more efficient although i havent yet got to profile both approaches.

Second approach (generating pure python module with all properties) is
non intrusive to crystalspace meaning the properties modules can be
generated at any time using the generator and be used. Of course it
would be nice also to have crystalspace build system aware of this so
the modules can be generated, but its not a hard requirement.

Both approaches are working already, you can see the files this
generates for current crystalspace svn:
http://leapingcat.org/pablo/crystalattributes.i
http://leapingcat.org/pablo/csproperties.py

My question would be what approach do people think is better? I think i
slightly prefer the first method as it doesnt require an additional
module and provides totally self contained bindings (ie, user would not
have to be aware of the properties modules to use them), but right now
im not totally sure.

Note one way or the other, i intend to support more the interfaces with
properties, and intend to provide all documentation for this, as well as
plenty of examples of use, as i feel it makes much nicer bindings, much
nicer syntax and would allow new users to grasp the interfaces much
faster (and helps to get the feel that cs is easy ;-)).

Greetings!!

 Pablo


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to