5 ms·
Constructive feedback for the article is welcome. Thanks!
by germandiago 5y ago
Constructive feedback for the article is welcome. Thanks!
- Rochus 5y agoDid you have a look at e.g. https://root.cern.ch/root/html534/guides/users-guide/CINT.html https://root.cern.ch/root/html534/guides/users-guide/CINT.ht... and https://root.cern/cling/ https://root.cern/cling/? > Lua ... It has unfamiliar syntax ... start indexing at 1 Syntax is not unfamiliar, just more Pascal like; if you use LuaJIT you can use zero based indices and a powerful FFI for direct C code integration.
- germandiago 5y agoWell, by this I mean "unfamiliar to me", of course. Lol. Actually Lua is something to consider from the point of view of usage: it is an industry standard actually. However, all those small quirks in semantics... and classes can be done in many ways (that is what I understand, via metatables)... In ChaiSCript or Wren there is one true way and you are done. You might like it or not, but it leads to less confusion, especially if you use most of the time what is in the mainstream. This is by no means a bad thing in itself, it is just about how ergonomic or time-consuming it could be for myself: I just feel more comfortable with ChaiScript, Wren or Squirrel than with Lua. Even AngelsCript is also more similar to what you already have. So when exposing APIs there is much less friction. Truth to be told, there is also https://github.com/ThePhD/sol2 https://github.com/ThePhD/sol2 which looks great and something to consider. It makes binding things quite easier and gives you object-oriented Lua. You could rely on that. It was just my subjective choice. There is no 100% right choice. Probably, if I found people that are comfortable with Lua I would use that. But the case is that this is a project of mine as it stands now.
- jcelerier 5y ago> Syntax is not unfamiliar, just more Pascal like; how is that not unfamiliar
- Rochus 5y agoWell, why would you then consider Python to be familiar?
- oblio 5y agoBecause Python is 100000x more popular than Pascal in 2021?
- germandiago 5y agoYou make a good point. I started my Computer Science and Engineering degree (I am european, not american, so the equivalent looks like kind of a merge of both areas) with Python, C and C++ on the programming side. Pascal was discarded a few years back in my university. And yes, by familiar I mean exactly what you mean: you see nowadays Java, Python, C++, C, C#, but Pascal is disappeared. Disappeared since long ago since I do not know even the syntax myself by casual reading around.
- Rochus 5y agoPython syntax is more similar to Pascal than to e.g. Java or JS. "Modula-3 is the origin of the syntax and semantics used for exceptions, and some other Python features." (from https://docs.python.org/3/faq/general.html#why-was-python-created-in-the-first-place https://docs.python.org/3/faq/general.html#why-was-python-cr...). Also the predecessor languages ABC and SETL were in the Algol tradition. > Python is 100000x more popular than Pascal It's about factor 8 on https://www.tiobe.com/tiobe-index/ https://www.tiobe.com/tiobe-index/ or factor 3 (in score) on https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2020 https://spectrum.ieee.org/static/interactive-the-top-program..., whatever you prefer as a reference. Delphi (which is Object Pascal) is still a widely used language.
- oblio 5y agoI generally go by job listings. It's trivial to find Python jobs, Pascal/Delphi jobs are very rare.
- germandiago 5y agoAs for looking at CINT, CLing, yes I did. I prefer to use a dynamic language with coroutines out of the box. It is actually what I was looking for besides ease of binding it and "familiarity" in semantics/syntax in a broad, imprecise way I defined for myself.
- pierrec 5y ago> if you use LuaJIT you can use zero based indices and a powerful FFI Not entirely, Lua standard libraries still expect everything to be one-indexed, while FFI structures are zero indexed. So with LuaJIT you often end up with a mix of 0 and 1 indexed code, which in my experience was workable but definitely a pain point.
- Rochus 5y agoYou should avoid the Lua C API in LuaJIT because it is not supported by the JIT (i.e. it makes your code running in the interpreter instead of the JIT). Using zero based indices in Lua code running on LuaJIT works well.
- pierrec 5y agoI'm not talking about the Lua C API, but things as simple as this: > stuff = {"one", "two", "three"} > stuff[1] one These native Lua structures are baked in, and they're a lot more flexible than FFI structures - presumably if you're using Lua, it's because you want to take advantage of that flexibility and those affordances. FWIW I've written a lot of LuaJIT, and usually I kept the lower-level FFI stuff separate from the higher-level code using Lua data structures, so I rarely encountered that discrepancy between them, but still something to keep in mind.
- Rochus 5y agoYou can e.g. do > stuff = { [0]="one", [1]="two" } > print(stuff[0]) one Works well; I wrote e.g. https://github.com/rochus-keller/Smalltalk#a-smalltalk-80-interpreted-virtual-machine-on-luajit https://github.com/rochus-keller/Smalltalk#a-smalltalk-80-in... that way. EDIT: even this works > stuff = { [0]="one", "two", "three" } > print(stuff[0]) -> one > print(stuff[1]) -> two
- pansa2 5y ago> stuff = { [0]="one", "two", "three" } In this case, is it possible to make iteration start with the element at index 0? Maybe by implementing a custom version of `ipairs`?
- Zababa 5y ago> Prefer dynamic to static typing, since static typing can remove the coding speed: it makes you think about types. I'm wondering what you mean exactly by this. Do you not think about types when programming with a language with dynamic typing?
- germandiago 5y agoNo, I think I expressed myself the wrong way. What I mean is that if you have to annotate all your code with types (like in AngelScript), this will slow you down for two reasons. First, you need to think about types, and second, refactoring is more rigid. If it is optional, it is ok, you can take advantage of it at will (ChaiScript supports types in parameters, but optionally).
- Zababa 5y agoThanks, that clarifies it and makes sense.
- olvy0 5y agoI'm late to the party here, but just wanted to add that AngelScript added support for auto declaration like in C++11 some time ago. https://www.angelcode.com/angelscript/sdk/docs/manual/doc_datatypes_auto.html https://www.angelcode.com/angelscript/sdk/docs/manual/doc_da...