Live data from Hacker News

TOML, Tom's Own Markup Language

github.com

11–20 of 173 posts

Re: TOML, Tom's Own Markup Language

#11
post #9

Urg. Off topic, but I dislike this perl/ruby tendency of calling hash tables hashes . When I see the word hash , I always think of a value (ie a hash code) and not a data structure. Why couldn't they call it a hash map, hash table, map, table, dictionary etc like all the other languages...?

I agree with that. 'map' or 'dictionary' are the best choices I think (or 'associative array', but why bring arrays into it). That's the interface, of which a hash table is just one possible implementation.

Re: TOML, Tom's Own Markup Language

#12
post #7
post #6

Earlier quoted context omitted.

Well, he's the CEO of Github, and he's probably been drinking, so I suppose a little bit of arrogance is expected.

For the love of baby jesus why can't people get the 'H' right.

As proper nouns become more common, they first lose any capitalization in the middle of the word, and then finally capitalization of the initial letter. It's human language. It happens.

Re: TOML, Tom's Own Markup Language

#14
post #9

Urg. Off topic, but I dislike this perl/ruby tendency of calling hash tables hashes . When I see the word hash , I always think of a value (ie a hash code) and not a data structure. Why couldn't they call it a hash map, hash table, map, table, dictionary etc like all the other languages...?

This bit of ruby should take care of it

    HashMap = HashTable = Map = Table = Dictionary = Hash
And if you're feeling adventurous,

    Object.send :remove_const, :Hash

Re: TOML, Tom's Own Markup Language

#16

Ruby parser here: https://gist.github.com/jm/5022483 Please fork and improve. :)

    # line 36
    text.split("#").first
This will have trouble with a line like:

    tweet = "TOML is #awesomesauce"
--

    # line 43
    array = $1.split(",").map {|s| s.strip.gsub(/\"(.*)\"/, '\1')}
You should recurse into coerce here, or you'll just lose types. (Also you're assuming arrays of strings.)

    array = $1.split(",").map {|s| coerce(s) }
--

You're also not dealing with nested key groups. (eg. [servers.alpha]).

--

That being said, naïve string parsing is a terrible way to build a new markup language implementation. It's the reason the Markdown landscape is such a mess[1]. What this really needed is a formal grammar.

[1]: I actually tried to fixed that by writing a formal lexer & informal parser for Markdown in a side-project of mine[2]. It's not quite there yet, because for practicality reasons I wrote my own parser instead of a formal AST-generating parser.

https://gist.github.com/kballenegger/29dabe4b6e762ee221df

[2]: http://getmacchiato.com

Re: TOML, Tom's Own Markup Language

#18

Ruby parser here: https://gist.github.com/jm/5022483 Please fork and improve. :)

Don't have time to work on it now, but it looks like you'll need to recurse while parsing arrays. Right now, only arrays of strings that don't contain commas are handled correctly.

Re: TOML, Tom's Own Markup Language

#19
Can't wait to see the end result.

This reminds me of a new project I'm working on called Leewh. It's based on Wheel and kinda has the same overall function, but I needed something to get my project rolling quickly and using .ini and JSON syntax separately felt... well... too square, I guess.

I figured I'll come up with something more well rounded.

Re: TOML, Tom's Own Markup Language

#20
post #7

Earlier quoted context omitted.

For the love of baby jesus why can't people get the 'H' right.

As proper nouns become more common, they first lose any capitalization in the middle of the word, and then finally capitalization of the initial letter. It's human language. It happens.

Yes, and I think it's arrogance on the part of Wordpress (there I did it) folks to insist that everyone capitalize it in the prescribed manner. Especially since they weren't consistent from the get-go. They even went so far as to make Wordpress (trolol) itself filter content to be capitalized if someone tries using the lower case p. http://justintadlock.com/archives/2010/07/08/lowercase-p-dan...
Post reply on HN