Earlier quoted context omitted.
This is a good point, but I feel that discouraging this type of approach is not the way to go. I apologise in advance for ranting... I hope this is not too off-topic, but instead a "zoom out" on the issue. This touches on something deep and wrong about how we use computers these days. Computers are really good at being computers, and the amplification of intellectual capabilities they afford is tremendous, but this i…
Lack of Turing-completeness can be a feature. Take PDF vs PostScript. The latter is Turing-complete and therefore you cannot jump to an arbitrary page or even know how many pages the document has without running the entire thing first. By limiting expressiveness you also gain static analysis and predictability. It's not about limiting the potential of computers, it's about designing systems that strike the right bala…
Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
241–250 of 265 posts
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#242Earlier quoted context omitted.
Lack of Turing-completeness can be a feature. Take PDF vs PostScript. The latter is Turing-complete and therefore you cannot jump to an arbitrary page or even know how many pages the document has without running the entire thing first. By limiting expressiveness you also gain static analysis and predictability. It's not about limiting the potential of computers, it's about designing systems that strike the right bala…
If you have a nice data format like s-exprs, it's a fairly simple matter to just aggressively reject any code/data that can't be proven harmless. For example, if you're loading saved game data, just verify that the table contains only tables with primitive data; if there's anything else, throw an error. Then you can safely execute it in a turing-complete environment and be sure it won't cause problems. Speaking for m…
It's a relatively new data format designed by Rich Hickey that has versioning and backward-compatibility baked in from the start.
EDN stands for "Extensible Data Notation". It has an extensible type system that enables you to define custom types on top of its built-in primitives, and there's no schema.
To define a type, you simply use a custom prefix/tag inline:
#wolf/pack {:alpha "Greybeard" :betas ["Frostpaw" "Blackwind" "Bloodjaw"]}
While you can register custom handlers for specific tags, properly implemented readers can read unknown types without requiring custom extensions.The motivating use case behind EDN was enabling the exchange of native data structures between Clojure and ClojureScript, but it's not Clojure specific -- implementations are starting to pop up in a growing number of languages (https://github.com/edn-format/edn/wiki/Implementations).
Here's the InfoQ video and a few threads from when it was announced:
https://news.ycombinator.com/item?id=4487462, https://groups.google.com/forum/#!topic/clojure/aRUEIlAHguU, http://www.infoq.com/interviews/hickey-clojure-reader
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#243Earlier quoted context omitted.
Lack of Turing-completeness can be a feature. Take PDF vs PostScript. The latter is Turing-complete and therefore you cannot jump to an arbitrary page or even know how many pages the document has without running the entire thing first. By limiting expressiveness you also gain static analysis and predictability. It's not about limiting the potential of computers, it's about designing systems that strike the right bala…
http://en.wikipedia.org/wiki/PostScript#The_language PostScript is Turing-complete.
Back on topic: The reason for PDF's existence is to be a non-turing complete subset of postscript. Features like direct indexing to a page are why Linux has switched to PDF as the primary interchange format.
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#244Earlier quoted context omitted.
If you have a nice data format like s-exprs, it's a fairly simple matter to just aggressively reject any code/data that can't be proven harmless. For example, if you're loading saved game data, just verify that the table contains only tables with primitive data; if there's anything else, throw an error. Then you can safely execute it in a turing-complete environment and be sure it won't cause problems. Speaking for m…
Have you checked out EDN yet ( https://github.com/edn-format/edn )? It's a relatively new data format designed by Rich Hickey that has versioning and backward-compatibility baked in from the start. EDN stands for "Extensible Data Notation". It has an extensible type system that enables you to define custom types on top of its built-in primitives, and there's no schema. To define a type, you simply use a custom prefix…
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#245Earlier quoted context omitted.
Lack of Turing-completeness can be a feature. Take PDF vs PostScript. The latter is Turing-complete and therefore you cannot jump to an arbitrary page or even know how many pages the document has without running the entire thing first. By limiting expressiveness you also gain static analysis and predictability. It's not about limiting the potential of computers, it's about designing systems that strike the right bala…
http://en.wikipedia.org/wiki/PostScript#The_language PostScript is Turing-complete.
Here's my attempt at a clearer version:
"Take Postscript vs PDF. Postscript is Turing-complete and therefore you cannot jump to an arbitrary page or even know how many pages the document has without running the entire thing first."
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#246Earlier quoted context omitted.
For those who missed it, here's what Linus wrote in the comments: "+Aaron Traas no, XML isn't even good for document markup. Use 'asciidoc' for document markup. Really. It's actually readable by humans, and easier to parse and way more flexible than XML. XML is crap. Really. There are no excuses. XML is nasty to parse for humans, and it's a disaster to parse even for computers. There's just no reason for that horribl…
Linus' adversion to XML explains also why parsing git's output is so abysmal inconsistent. Subversion has a really good XML output for its log command which is a joy to use (and that's something to say if you work with XML) whereas with git you always have ugly format options that are most of the time underdocumented.
Git's output was designed in the Unix spirit; you can parse it very quickly without needing a parser toolchain.
It's also extensively documented: git help log, etc
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#247Earlier quoted context omitted.
Lack of Turing-completeness can be a feature. Take PDF vs PostScript. The latter is Turing-complete and therefore you cannot jump to an arbitrary page or even know how many pages the document has without running the entire thing first. By limiting expressiveness you also gain static analysis and predictability. It's not about limiting the potential of computers, it's about designing systems that strike the right bala…
http://en.wikipedia.org/wiki/PostScript#The_language PostScript is Turing-complete.
"Take PDF vs PostScript. The latter is Turing-complete"
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#248Earlier quoted context omitted.
Same as the XML
I don't think XML does either by itself. The schema will determine which fields are parsed as strings and which are parsed as numbers.
And the vast majority of parsers will not parse anything for you, regardless of schema definitions.
Which effectively puts you in the same place as the JSON string.
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#249Earlier quoted context omitted.
I think it's refreshing to hear someone advocate XML instead of JSON, specifically because you bring up a good point. The problem I think is that just because XML is human-readable, it's less sufficient as a format that is human-writable (I'm looking at you, Maven!). I believe this is the root cause that many people hate XML, even though it has a very sweet spot in application-to-application communication.
I would even argue that XML is not even that human-readable. Take a look at this pom: https://maven.apache.org/pom.html#The_Super_POM . Even with syntax highlighting it is extremely difficult to parse visually. Compare that to nginx's custom config file format: http://wiki.nginx.org/FullExample .
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#250Earlier quoted context omitted.
My biggest hatred of xml as a data structure, and believe me I've seen this in production systems more then once, is that it allows for the following. Personal ... Business ... 496F3AB This may seem innocuous, but XML allows mixing of arrays and objects too liberally, and makes automatic parsing overly complex. At first appears to be an array of account objects, but wait now that we reach the end we find that is an o…
Well yes. The problem there is that someone made a bad decision on how to structure their XML. If the same was done like this: Personal ... Business ... it would make a lot more sense, I think.
The really annoying issue is as the parent says, that the accounts collection does not have a name. This means there's no canonical mapping for the structure into a programming language object, which necessitates that libraries require annotations or some other side-channel way of specifying how to wrap the accounts into a collection.
In Jaxb e.g., how many times must we add junk like:
@XmlElementWrapper(name = "accounts") ?
In any individual case the workaround is easy, but it's annoying to have to do it repeatedly.XML really is better as document markup than structured data representation.