TelluIoT / ThingML

The ThingML modelling language

Home Page:https://github.com/TelluIoT/ThingML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Basic String operators are needed

brice-morin opened this issue · comments

The + is sometimes used as a hack to concatenate strings in ThingML. This is not the intended usage of +, see #51. However, string concatenation is severely lacking in ThingML, though + is a useful hack as it works in at least JS and Java.

Having a proper concatenation operator (not necessarily with the + syntax) would make it much easier to implement simple serializers in a PIM way in ThingML.

Here is some inspiration if you want to implement more operators than a fancy StringBuilder:

Most of the methods could probably go into the STL. My personal preference is Ruby, but I would not mind doing it the Go way or JS (JS is a bit too Perl IMHO). Notice that I didn't link the Java doc'.

The problem is the C generator, where it can be difficult to determine automatically when strings or dynamic structure should be freed... while other languages are garbage collected. And we probably do not want malloc and free in ThingML action language...