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

recursive datastructures #21

Open
fergusq opened this issue Sep 25, 2014 · 3 comments
Open

recursive datastructures #21

fergusq opened this issue Sep 25, 2014 · 3 comments

Comments

@fergusq
Copy link

fergusq commented Sep 25, 2014

An easy way to create recursive datastructures (eg. linked lists).

In the current implementation, they have to be emulated through an array.

Dim linkedlist As Integer[100][2] ' the first item is the data value, and the second a link to the next

This implentation is limited-size. Some kind of structure type could make handling data of unknown size more reliable.

Suggested syntax:

Structure Link
    data as Integer
    nextLink as Link
End Structure
@henkkuli henkkuli added this to the Compiler 3.0 milestone Sep 25, 2014
@henkkuli
Copy link
Collaborator

We have already been thinking of adding structures. In my opinion default values for everything should be 0. If the value of a strcuture is 0, then it is intepreted so that every child is also 0. That way there can be recursive data structutes without having to save infinte amount of recursive data. Then there should also be some kind of way to test if the structure is empty or not, possibly with Is Nothing operator.

@SamiKalliomaki
Copy link
Owner

We would preferably need some kind of pointers at some point because it would allow structures like two directional linked list.

@fergusq
Copy link
Author

fergusq commented Sep 26, 2014

if all objects were references like in java and javascript, pointers would not be needed; pointers like in C are not always easy to understand

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

No branches or pull requests

3 participants