my_basic
my_basic copied to clipboard
Is there a way to have nested dictionaries?
Something like:
a=dict() a(1)=dict()
a(1)(1)="test"
In Lua or Python it is possible. Is it possible in my_basic? The above syntax doesn't work (I know it can be done with GET and SET, but I wondered if there was a more readable way to do it)
I really like this project, for its extreme compactness, and for how much it can achieve with such a small size
Use this:
a = dict
(
1,
dict
(
1, "test"
)
)
But the only way to retrieve nested is get(get(a, 1), 1).
Thank you for the quick answer. That's a shame, is there any plan to change that behavior in the future? I think it would increase the potential of the language a lot. Also, how does my_basic perform compared to lua? The ability to use real arrays should make it faster, but lua on the other end claims to have some optimizations.
At the moment I am trying to integrate it with my 3d library OpenB3D, since it seems a promising language.
I forgot to say: I have also ported the header to FreeBasic, to be able to use my_basic from a FB source:
https://www.freebasic.net/forum/viewtopic.php?f=17&t=29109
Feel free to tell me if I made any mistake
For the moment I'm working on other projects, lacking in time to make that change.
I haven't compared array specifically, but Lua is overall faster than MY-BASIC. For my experience the performance of MY-BASIC is already significant to support a variant range of applications.
It's interesting to see MY-BASIC running in another BASIC :D