3 ms·
"Nudge uses Space, a new lightweight object-oriented programming language" Is this a joke? Space seems to be just a lightweight JSON replacement http://spacefu
by lightningstorm 13y ago
"Nudge uses Space, a new lightweight object-oriented programming language"
Is this a joke? Space seems to be just a lightweight JSON replacement
http://spaceful.org/ http://spaceful.org/
- carbocation 13y agoI don't get it, either. I guess it's supposed to be Space:JSON::CoffeeScript:Javascript? But it seems less useful: in their example, the user clearly wanted to create an array of colors. What they got instead was a map with colors as keys and empty objects as values.
- breck 13y agoSorry, that was an old example. Will throw a better one up there shortly.
- breck 13y agoEdited. Should have said "encoding language". Here are some examples of space in action: - http://sender.nudgepad.com/demo.html http://sender.nudgepad.com/demo.html - http://nudgepress.com/ http://nudgepress.com/ It is very useful. Happy to answer questions about it.
- vidarh 13y agoWhat does this give you over e.g. YAML, which has widespread support? Not that I like YAML either - I detest encodings that depend on indentation for meaning...
- breck 13y agoIt's much simpler than YAML. Some might argue too simple, but there's enough there for many use cases.
- paragraft 13y agoIts list handling seems broken? tojson(fromjson(x)) !== x. Paste { "name": "John", "age": "29", "foo": [1,2,3] } into the JSON side, and click in the left and move the cursor to force it to update and see what happens (I see it drop the first two list items).
- anonymoushn 13y agoIt can't handle lists. A spaces object is a JS object whose keys contain no newlines or spaces, whose string values contain no newlines, and whose non-string values are spaces objects (definitely not null/boolean/number/array).
- breck 13y agoCorrect. We can turn all JSON to Space easily, but there's no canonical way to turn all Space into JSON (although you can do it easily for a particular use case). Unlike JSON, in Space order is important and you can have duplicate properties. So in JSON you can't do this: ``` { 'h1' : 'hello world', 'h1' : 'this is a test', } ``` But you can do that in Space.
- anonymoushn 13y agoIs there a spec or a grammar somewhere? Edit: here we go https://github.com/nudgepad/space/blob/master/spec.txt https://github.com/nudgepad/space/blob/master/spec.txt
- spaux 13y agoWhy would you use this over JSON? Looks like if your application makes heavy use of arrays, space will take way more 'space' than JSON. eg: {"test":[1,2,3]} vs test\n item 1\n item 2\n item 3\n
- breck 13y agoSpace is great for building DSLs on top of. You often want to have additional types that your domain specific code recognizes. For example, your example could also be written in a DSL that is also valid space: ``` test [1,2,3] ``` Space is best for cases where you have small to medium sized objects that are often viewed/edited by humans, such as APIs, config files, schemas, or database objects.