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

wdte: add syntactical support for array and string indexing #50

Open
DeedleFake opened this issue Oct 25, 2017 · 1 comment
Open

wdte: add syntactical support for array and string indexing #50

DeedleFake opened this issue Oct 25, 2017 · 1 comment

Comments

@DeedleFake
Copy link
Owner

Using a.at and str.at is rather annoying in a lot of situations, especially for something that is so common. A syntax for indexing would be useful, although the existing functions should probably be left in for easier use in the chains. If the syntax can support slicing, that would also be useful.

Unfortunately, due to the way the parse works, using [] for indexing is not really possible. Possible alternatives:

  • array[@i]. Possible, but a bit unwieldy. Definitely better than using the std functions, though.
  • array.i. Ambigous, but it should be possible. Doesn't really work for slicing, though.
  • array.[i]. Possible, but only by making .[ a single token. Probably the cleanest, though.
@DeedleFake DeedleFake self-assigned this Oct 25, 2017
@DeedleFake DeedleFake added this to Percolating in Initial Implementation Oct 25, 2017
@DeedleFake
Copy link
Owner Author

Alternative: Put an at function directly in std which can access indices of both strings and arrays. Not having to import it would be a bit easier, although it's potentially still a bit awkward. Might also want to put slice and len functions that would work on both strings and arrays.

@DeedleFake DeedleFake changed the title Add Syntactical Support for Array/String Indexing wdte: add syntactical support for array and string indexing Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Initial Implementation
  
Percolating
Development

No branches or pull requests

1 participant