Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » FEAT: Tcl as a plugin
FEAT: Tcl as a plugin [message #31029] Tue, 01 February 2011 20:40 Go to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
hi guys

stumbeling over the need of a scripting language execution environment, i tried to analyze Esc a bit, not too far. and while it's native Upp, it seems to be quite slow, as mirek stated in some post, due to data model which is geniously simple but...

so why not offering another possib?


Tcl..


licence is BSD, best fit Smile

there is even a c++ stuff available
http://cpptcl.sourceforge.net/

which as is total free license too.
unfotunately it depends on boost.

but, if anyone has got some experience..
that might be a good shot to have it in plugin.
imaginable, that the c++ wrapping needs a refactoring to get rid of boost, since Upp offers good stuff too.
Re: FEAT: Tcl as a plugin [message #31030 is a reply to message #31029] Tue, 01 February 2011 22:02 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi,

Did you see the Tcc package in bazaar? It allows to compile a c program in memory (very fast) and run them right away. Also it is possible to call functions from your c++ code, so it can be nicely used instead of scripting.

Of course, if you feel like creating Tcl plugin, you can Smile Having a more choices is always good...

Best regards,
Honza
Re: FEAT: Tcl as a plugin [message #31036 is a reply to message #31030] Wed, 02 February 2011 08:42 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

dolik.rce wrote on Tue, 01 February 2011 23:02

Hi,

Did you see the Tcc package in bazaar? It allows to compile a c program in memory (very fast) and run them right away. Also it is possible to call functions from your c++ code, so it can be nicely used instead of scripting.

Of course, if you feel like creating Tcl plugin, you can Smile Having a more choices is always good...

Best regards,
Honza


Did you compared with v8 JavaScript from google?

I'm interested what is the best.

Thank you in advance.
Re: FEAT: Tcl as a plugin [message #31037 is a reply to message #31036] Wed, 02 February 2011 09:28 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
seems quite interesting
http://code.google.com/apis/v8/design.html

i'm also more towards OOP, so JS V8 would do a great deal.
how extensible is it? i mean registering own types, callbacks etc?

Python or Ruby are another option..
what about license there and the extensibility?


[Updated on: Wed, 02 February 2011 09:29]

Report message to a moderator

Re: FEAT: Tcl as a plugin [message #31040 is a reply to message #31037] Wed, 02 February 2011 09:51 Go to previous messageGo to next message
oan1971 is currently offline  oan1971
Messages: 7
Registered: April 2010
Promising Member
Hi,

quite a long time ago I had to use Tcl at work. The only thing I remember about it is that I deliberately decided to erase every memory of it from my mind Smile.

I am using python at work now and think it is very good. Its license should be OK. The Python web site states:

Quote:

The Python implementation is under an open source license that makes it freely usable and distributable, even for commercial use. The Python license is administered by the Python Software Foundation.


Best regards,
Oliver



910eb20c14e026a87ffb2b0d38b9ddb7

[Updated on: Wed, 02 February 2011 11:14]

Report message to a moderator

Re: FEAT: Tcl as a plugin [message #31041 is a reply to message #31040] Wed, 02 February 2011 09:59 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
http://en.wikipedia.org/wiki/Python_(programming_language)
see programming philosophy

sounds quite good, dynamic typing, multi paradigm, highly extensible, small core with lots of extensions, highly readable code, late binding..

though it seems to be slower than V8, but more extensible..

i vote for Python too.., or JS V8

Tcl seems out of race Smile

EDIT: as of JS V8, it *precompiles* the things, which is faster, but ofcorse doesnt offer the degree of dynamics later in an application. but Esc is kind of 'precompiling' as well.

my goal is to have python console in my application, so to speak, a gui app, where one can access, define and modify the parameters and properties of the elements / controls at runtime..

[Updated on: Wed, 02 February 2011 10:03]

Report message to a moderator

Re: FEAT: Tcl as a plugin [message #31042 is a reply to message #31041] Wed, 02 February 2011 10:11 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
theres a codeproject for it Smile
http://www.codeproject.com/KB/cpp/embedpython_1.aspx
Re: FEAT: Tcl as a plugin [message #31044 is a reply to message #31041] Wed, 02 February 2011 10:21 Go to previous messageGo to next message
chickenk is currently offline  chickenk
Messages: 169
Registered: May 2007
Location: Grenoble, France
Experienced Member
Well if we go that way and want to find a scripting language to embed, I'm gonna give my 2 cents.

I personally love ruby and I know it's easy to embed, the C API is very clean. I also start to like python, but I don't know whether it's easy to embed or not.

But definitely, I would recommend lua.

This is THE scripting language totally designed to be embedded, and it is very powerful and most importantly, extremely fast. Try googling for luaJIT.

Besides, here is a comparison website that is really useful. I tried to put in the chart some elements of comparison (sorry, Tcl is not in the list):

http://shootout.alioth.debian.org/u32/which-programming-lang uages-are-fastest.php?gpp=on&luajit=on&v8=on&lua =on&python=on&yarv=on&calc=chart

This one is also interesting, where all languages are given a weight 2 for speed and weight 1 for size in memory (you can change these weights to your liking, depending on what you expect). In this chart, we can see LuaJIT is the first non-compiled language (well ok, it's compiled by the JIT engine but in realtime) in 8th position.

http://shootout.alioth.debian.org/u32/which-language-is-best .php?calc=calculate&xfullcpu=2&xmem=1&xloc=0& ;amp ;nbody=1&fannkuchredux=1&meteor=0&fasta=1&sp ectralnorm=1&revcomp=1&mandelbrot=1&knucleotide= 1&regexdna=1&pidigits=1&chameneosredux=0&thr eadring=0&binarytrees=1

Really, lua is an easy language, easy to embed, very light on memory and really fast even without the JIT. Please do have a look at it.

Lionel

[Updated on: Wed, 02 February 2011 10:23]

Report message to a moderator

Re: FEAT: Tcl as a plugin [message #31045 is a reply to message #31044] Wed, 02 February 2011 10:33 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
looks reeeeallly nice Smile

doesnt speak anything against including both..
to choose best fit later

python is more common though, but lua is more leightweight.. as as i got the impression

EDIT:
could you provide an embedded lua test project?
i'll try python (no idea about that one either, so freshy experience on embedding)

[Updated on: Wed, 02 February 2011 10:36]

Report message to a moderator

Re: FEAT: Tcl as a plugin [message #31046 is a reply to message #31045] Wed, 02 February 2011 11:10 Go to previous messageGo to next message
chickenk is currently offline  chickenk
Messages: 169
Registered: May 2007
Location: Grenoble, France
Experienced Member
kohait00 wrote on Wed, 02 February 2011 10:33

could you provide an embedded lua test project?



Well I've never embedded it myself, but the EFL (http://www.enlightenment.org) have had the same problematic, i.e. for their theming engine Edje, they had their own scripting language called Embryo (compare it to Esc) and they decided to augment their scripting power by adding Lua.

Unfortunately here, it's C and not C++. But I believe it should be relatively easy to find a C++ project embedding Lua. It's renowned for being embeddable so I'm sure you can find something. And as stated by the Lua team:
From the Lua reference manual:

Lua is implemented as a library, written in clean C (that is, in the common subset of ANSI C and C++).

In the meantime:

Re: FEAT: Tcl as a plugin [message #31051 is a reply to message #31046] Wed, 02 February 2011 14:03 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
python: tackling some compile issues, but should be no big deal..

meanwhile, there is stuff to read
http://docs.python.org/extending/embedding.html

EDIT:
some comparisons and desision help
http://thinkbeforetype.com/2010/09/12/lua-vs-python-as-embed ded-scripting-language/
http://lua-users.org/wiki/LuaVersusPython

[Updated on: Wed, 02 February 2011 15:41]

Report message to a moderator

Re: FEAT: Tcl as a plugin [message #31055 is a reply to message #31045] Wed, 02 February 2011 18:09 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Hi,

personally, I would also go for Lua, because of the advantages already mentioned.
The only disadvantage compared to other scripting alternatives I see is the lack of a huge library like there is for Python and Ruby for example.

kohait00 wrote on Wed, 02 February 2011 10:33


could you provide an embedded lua test project?


Have a look here:
http://www.ultimatepp.org/forum/index.php?t=msg&goto=221 58&&srch=LuaPlus#msg_22158

Matthias
Re: FEAT: Tcl as a plugin [message #31056 is a reply to message #31055] Wed, 02 February 2011 19:15 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
one thing to still consider with lua: it does not offer easy to handle class definitions, in python it seems to be esier.

but as stated out, having them both would be a great deal anyway..for different aspects one can choose what fits.
Re: FEAT: Tcl as a plugin [message #31061 is a reply to message #31037] Thu, 03 February 2011 10:50 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

kohait00 wrote on Wed, 02 February 2011 10:28

seems quite interesting
http://code.google.com/apis/v8/design.html

i'm also more towards OOP, so JS V8 would do a great deal.
how extensible is it? i mean registering own types, callbacks etc?

Python or Ruby are another option..
what about license there and the extensibility?





V8 has BSD license.
http://code.google.com/apis/v8/terms.html

V8 JS is very good used and improved. I vote for V8 JS.

In the near future I will try to integrate v8 in U++.
Re: FEAT: Tcl as a plugin [message #31063 is a reply to message #31061] Thu, 03 February 2011 11:23 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
this one can be integrated as well,
indeed, i think, enriching Upp with some popular script languages is a good deal to propell its usabilty and usage among other frameworks..
Re: FEAT: Tcl as a plugin [message #31864 is a reply to message #31063] Thu, 31 March 2011 14:42 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
so now there is Python in bazaar..but only a starting point.
any help apriciated. i'd love to spare me some work and use boost/python which seems quite straight forward from user POV.

maybe this can be acomlished by making a plugin/boost

reasons for Python over the others:
it's got a quite beutiful syntax Smile and is more 'popular' (arguable) than the rest, but at least more extensible and multipurpose. supporting class/modules definition, which is not available in the others, at least not with little effort (Lua). but this doesnt mean the others shouldnt come to Upp.
Re: FEAT: Tcl as a plugin [message #31957 is a reply to message #31864] Mon, 11 April 2011 14:53 Go to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
for further Python discussion
http://www.ultimatepp.org/forum/index.php?t=msg&goto=318 89&#msg_31889
Previous Topic: WARNINGS: LOG -> empty statement in RELEASE
Next Topic: Possible issue in Controls4U::Meter
Goto Forum:
  


Current Time: Thu Mar 28 18:57:22 CET 2024

Total time taken to generate the page: 0.01415 seconds