-
Notifications
You must be signed in to change notification settings - Fork 11
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
structured data #155
Comments
I agree with you that it would be very nice to work with such data structures in a meaningful way in nash scripts (without external tools like jq), but I'm not sure this will ever happen... I'm not against someone implementing this as long as it's not built in. Nash libraries could be created for that and we can ship this nashscript libraries alongside nash, but it'll not be easy to develop with current nash, mostly because nash language is very minimal and this data formats are pretty complex. You may think that For example, nash doesn't have an hash table data structure, nor the concept of objects/structs, then the json/yaml/etc must be parsed into a list representing an object. A list is a powerful data structure that you can store almost everything, but a tree/object or a hash table is very inefficient and hard to work with on top of it. Schemers (r5rs ones) create such libraries this way, but it sucks. As I do think this would be great, we can discuss improvements in nash supported data structures and syntax-constructs to easy creating that in the future (if more people involved see value, of course). Adding a hash table data type is something I'm thinking for a long time, but adding other types as integers, floats, and so on, bring some interesting trade offs. Apart from that, there are one missing features in nash to enable creating such libraries in scripts. A An external tool can be used to generate the lexical tokens of the input, but even the lexer could be done in nash script if we add support to range over the characters/runes of a string in a for-loop. I do use json on some of my scripts, but they rely on |
@tiago4orion, do you mean a proper hash table or an abstract map implementation? |
I meant a |
IMO JSON/Yaml handling would add a considerable amount of complexity to nash. I agree that in some cases would be nice to have a simple way to generate JSON files, I just don't think it's a good idea to make this a built in feature for nash. |
It makes sense to have a built-in map, or hash, whatever would help this,
and users can write a library for parsing and/or generating whatever
structured data format they need. For example, even if one wanted to write
a library wrapping jq, it would be great to be able to store input/output
data in a native structure.
…On Thu, 12 Jan 2017, 00:51 Vitor Arins, ***@***.***> wrote:
IMO JSON/Yaml handling would add a considerable amount of complexity to
nash. I agree that in some cases would be nice to have a simple way to
generate JSON files, I just don't think it's a good idea to make this a
built in feature for nash.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/NeowayLabs/nash/issues/155#issuecomment-272043500>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAPWS9WLorCs_wN5p8HvUr04yrHRiMEmks5rRXj1gaJpZM4LeyG5>
.
|
Added #202 |
One of the major downsides of traditional shells is the lack of direct support for any of well-known structured data formats (e.g. JSON, YAML, or even XML example). As a modern implementation, Nash seems to be well positioned to implement support for such a data format, namely it'd be a great win if there was a way to read, modify, query and compose JSON in a syntactically meaningful way.
The text was updated successfully, but these errors were encountered: