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

hashmaps #20

Open
fergusq opened this issue Sep 24, 2014 · 6 comments
Open

hashmaps #20

fergusq opened this issue Sep 24, 2014 · 6 comments
Milestone

Comments

@fergusq
Copy link

fergusq commented Sep 24, 2014

Tables with string keys

@henkkuli
Copy link
Collaborator

What kind of syntax should they use? Probably for accessing data []-syyntax would be appropriate. But how about for the type? What hash function to use? A perfect hash based on trie or some other hash?

@henkkuli henkkuli added this to the Compiler 3.0 milestone Sep 24, 2014
@fergusq
Copy link
Author

fergusq commented Sep 24, 2014

Maybe

Dim map as Integer[String] is a hashmap
vs.
Dim array as Integer[Integer] = x which would be a variable length array (cannot be initiated, but assigned)

Integer[] would be an alias to Integer[Integer]

@henkkuli
Copy link
Collaborator

I think Dim map As Integer[String] should be just intepreted as an Integer array with the size of the value referenced by String. How about using {} for hash maps?

@fergusq
Copy link
Author

fergusq commented Sep 24, 2014

Do you mean Dim map as Integer{}? That is not logical, as then we should use map{key} as the accessing syntax.

I can't figure out a situation where I needed to create an array which has the size of the string type.

What about syntaxes {String=>Integer}, array [Integer].

@fergusq
Copy link
Author

fergusq commented Sep 24, 2014

Pascal-like syntaxes Dim map as Map[] of Integer and Dim array as Array[] of Integer could work

They could also support multiple keys, like Dim map as Map[,,] of Integer and Dim array as Array[12, 10] of Integer.

@SamiKalliomaki
Copy link
Owner

I would prefer the Integer[String] syntax. Note that user should be able to mix hashmaps and regular arrays. Eg. Dim foo As Integer[String][10][10]

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

3 participants