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

Is there a way to have nested dictionaries? #42

Open
angros47 opened this issue Apr 12, 2021 · 4 comments
Open

Is there a way to have nested dictionaries? #42

angros47 opened this issue Apr 12, 2021 · 4 comments

Comments

@angros47
Copy link

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

@paladin-t
Copy link
Owner

Use this:

a = dict
(
  1,
  dict
  (
    1, "test"
  )
)

But the only way to retrieve nested is get(get(a, 1), 1).

@angros47
Copy link
Author

angros47 commented Apr 13, 2021

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.

@angros47
Copy link
Author

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

@paladin-t
Copy link
Owner

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

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