Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic String operators are needed #277

Open
brice-morin opened this issue Jan 25, 2019 · 3 comments
Open

Basic String operators are needed #277

brice-morin opened this issue Jan 25, 2019 · 3 comments

Comments

@brice-morin
Copy link
Collaborator

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.

brice-morin added a commit that referenced this issue Jan 28, 2019
…(caveat: it uses + to concatenate strings... see #277)
@fungiboletus
Copy link
Contributor

fungiboletus commented Apr 5, 2019

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'.

@fungiboletus
Copy link
Contributor

More cool string methods from Ruby On Rails for inspiration.

@brice-morin
Copy link
Collaborator Author

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants