| ▲ | sevensor 3 days ago | |||||||||||||
Suppose you have the EDN text
There's a semantic error here; the name and age fields have been
swapped in the second element of the list. At some point, somebody
has to check whether :name is a string and :age is a number. If your
application is going to do that anyway, why do syntax typing?
You might as well just try to construct a number from "Wilma" at the
point where you know you need a number.Obviously I have an opinion here, but I'm putting it out there in the hope of being contradicted. The whole world seems to run on JSON, and I'm struggling to understand how syntax typing helps with JSON document validation rather than needlessly complicating the syntax. | ||||||||||||||
| ▲ | fulafel 2 days ago | parent | next [-] | |||||||||||||
I guess there are two questions: should the serialization format be coupled with the schema system, and should the serialization format have types. If you answer the first question with no, then the second question is revealed to just be about various considerations other than validation, such as legibility and obvious mapping to language types (such as having a common notation for symbols/keywords, sets, etc). JSON and EDN are similar here, if your comment was in context of JSON vs EDN difference. There's some incidental additional checking on the syntax level with EDN but that's not its purpouse. You can do interesting things with the data even if you don't parse/validate all of it. Eg an important feature of the spec schema system and philosophy is that you don't want closed specs, you want code to be able to handle and pass on data that is richer than what the code knows about, and if circumstances allow you shouldn't try to validate it in one place. | ||||||||||||||
| ▲ | delaguardo 3 days ago | parent | prev [-] | |||||||||||||
What do you mean under "syntax typing" and complications in the syntax? > The whole world seems to run on JSON That is true, and I don't like that :) From my perspective JSON syntax is too "light" and that translates to many complications typically in the form of convention: {"id": {"__MW__type": "LONG NUMBER", "value": "9999999999999999999999999"}}. | ||||||||||||||
| ||||||||||||||