Live data from Hacker News

The Lobster Programming Language

strlen.com

31–40 of 72 posts

Re: The Lobster Programming Language

#31
post #5

Obviously some will find this a silly opinion but the one thing that turned me off the most about the Nim programming language was its use of significant whitespace. The same is true with F# (and of course Python). Having had apps with YAML for config, and having had nightmares trying to copy/paste config directives from various sources, I just find whitespace to be unwieldy. Now that's a strong opinion, (weakly held…

> Having had apps with YAML for config, and having had nightmares trying to copy/paste config directives from various sources, I just find whitespace to be unwieldy.

Convert your YaML into JSON and save it in your YaML file. There is probably an online converter, but writing one in your language of choice should be less than ten lines of code.

Do the same YaML→JSON for the “source” configuration you want to copy from, and copy-paste the parts you want. Leave them as JSON.

Complaining about Python's significant whitespace, I get it. I don't mind it personally, but it's obligatory and you can't overcome it (unless you do `coding: with_braces` tricks, of course). But why one would complain about YaML's whitespace? It is not obligatory.

    some_key:
      attr1: val1
      attr2: 12312
is equivalent to

    {some_key: {attr1: val1, attr2: 12312}}
is equivalent to

    {"some_key": {"attr1": "val1", "attr2": 12312}}
is equivalent to

    {"some_key": {
    "attr1":
    "val1", "attr2": 12312
    }
    }
and they're all valid YaML (and on the plus side you can leave dangling commas at the end of sequences, but it won't be valid JSON anymore).

Re: The Lobster Programming Language

#32
post #9

Earlier quoted context omitted.

YAML has given me eye-twitching ever since I went on an ill-considered quest of setting up wifi on a Debian server years ago. I never figured it out by the way - just bought a really long LAN cable.

YAML with Go templating (like you'd find in Helm Charts) was enough to push me over the edge.

Was there any reason not to use flow collection style, which would free the templates from significant whitespace?

Re: The Lobster Programming Language

#33
post #31
post #5

Obviously some will find this a silly opinion but the one thing that turned me off the most about the Nim programming language was its use of significant whitespace. The same is true with F# (and of course Python). Having had apps with YAML for config, and having had nightmares trying to copy/paste config directives from various sources, I just find whitespace to be unwieldy. Now that's a strong opinion, (weakly held…

> Having had apps with YAML for config, and having had nightmares trying to copy/paste config directives from various sources, I just find whitespace to be unwieldy. Convert your YaML into JSON and save it in your YaML file. There is probably an online converter, but writing one in your language of choice should be less than ten lines of code. Do the same YaML→JSON for the “source” configuration you want to copy from…

> But why one would complain about YaML's whitespace? It is not obligatory.

The problem (as felt by me and also as identified by the person you replied to) is that you can't copy-paste/munge some stuff into the right spot and then just let the formatter to fix the indentation. It's not a problem that the format "at rest" has whatever certain indentation to be correct, its that while being actively editing your formatter cannot automatically set the correct indentation.

The flow that you're talking about of converting yaml to json and then putting it into yaml could work in some cases but thats very much a kludge. It will have numerous bad side effects unavoidable, including that it would discard comments in the middle since JSON doesn't allow for comments at all, theres no timestamps in JSON, there's no octal numbers, etc.

Re: The Lobster Programming Language

#34
post #31
post #5

Obviously some will find this a silly opinion but the one thing that turned me off the most about the Nim programming language was its use of significant whitespace. The same is true with F# (and of course Python). Having had apps with YAML for config, and having had nightmares trying to copy/paste config directives from various sources, I just find whitespace to be unwieldy. Now that's a strong opinion, (weakly held…

> Having had apps with YAML for config, and having had nightmares trying to copy/paste config directives from various sources, I just find whitespace to be unwieldy. Convert your YaML into JSON and save it in your YaML file. There is probably an online converter, but writing one in your language of choice should be less than ten lines of code. Do the same YaML→JSON for the “source” configuration you want to copy from…

My gripe with json is the lack of support for comments. Whenever I come across a config file that has comments about what the config line(s) mean, I am so grateful.

Whenever I come across a json config file, I kind of despair a little and start poking at the code in hopes there are comments about what the config means.

Re: The Lobster Programming Language

#35
post #5

Obviously some will find this a silly opinion but the one thing that turned me off the most about the Nim programming language was its use of significant whitespace. The same is true with F# (and of course Python). Having had apps with YAML for config, and having had nightmares trying to copy/paste config directives from various sources, I just find whitespace to be unwieldy. Now that's a strong opinion, (weakly held…

[deleted]

Re: The Lobster Programming Language

#36
post #33
post #31

Earlier quoted context omitted.

> Having had apps with YAML for config, and having had nightmares trying to copy/paste config directives from various sources, I just find whitespace to be unwieldy. Convert your YaML into JSON and save it in your YaML file. There is probably an online converter, but writing one in your language of choice should be less than ten lines of code. Do the same YaML→JSON for the “source” configuration you want to copy from…

> But why one would complain about YaML's whitespace? It is not obligatory. The problem (as felt by me and also as identified by the person you replied to) is that you can't copy-paste/munge some stuff into the right spot and then just let the formatter to fix the indentation. It's not a problem that the format "at rest" has whatever certain indentation to be correct, its that while being actively editing your format…

> The problem (as felt by me and also as identified by the person you replied to) is that you can't copy-paste/munge some stuff into the right spot and then just let the formatter to fix the indentation.

That problem I undestand, and that is why I suggested to convert both into JSON —or YaML with default_flow_style=True which would preserve datetimes and other non-JSON stuff— and copy-paste without the hassle of having to indent/unindent correctly. Of course that doesn't help with copying comments. That would need extra copy-paste operations, but still one hasn't the hassle of significant whitespace. The following is also valid YaML:

    {"some_key": {
    "attr1":
    # an intermittent comment
    "val1", "attr2": 12312  # more comments!
    }
    }

Re: The Lobster Programming Language

#37
post #34
post #31

Earlier quoted context omitted.

> Having had apps with YAML for config, and having had nightmares trying to copy/paste config directives from various sources, I just find whitespace to be unwieldy. Convert your YaML into JSON and save it in your YaML file. There is probably an online converter, but writing one in your language of choice should be less than ten lines of code. Do the same YaML→JSON for the “source” configuration you want to copy from…

My gripe with json is the lack of support for comments. Whenever I come across a config file that has comments about what the config line(s) mean, I am so grateful. Whenever I come across a json config file, I kind of despair a little and start poking at the code in hopes there are comments about what the config means.

I totally agree with your gripe about JSON's lack of comments. There were people AFAIK who tried to write a spec with comments (and maybe dangling commas? was it called JSON5?) but by then it probably was too late.

Re: The Lobster Programming Language

#38

Earlier quoted context omitted.

Never understood how putting up roadblocks for developers trying to copy-paste code was deemed acceptable, or GVR (and others) thought the solution to poorly formatted code was making formatting carry semantics instead of just writing an auto formatter.

To be fair to GvR, autoformatters weren’t commonplace in the late 80s and early 90s. Were there even any? Ever since Go got big, though, everyone else is discovering how fantastically nice they are, and that’s a good thing.

GNU indent was already at version 1.9.1 by 1994: https://ftp.gnu.org/gnu/indent/

If you grab that version and unpack it and look at /OChangelog then it seems to date back until at least 1989, same as Python itself.

That was for C source, of course. I expect there were pre-GNU indent variants, perhaps posted on comp.sources.unix and maybe some commercial things as part of very expensive compiler packages.

I would say that running autoformatters in any kind of routine way was pretty rare. EDIT: but I think ascribing the language design to commonality or not is probably ahistorical. Even today it's a rather passionate debate. And even at the time, Lisp - the poster child of copy-paste friendly PLangs - was routinely autoformatted within Emacs', but that was not enough for people to not find Lisp code "ugly".

Re: The Lobster Programming Language

#39
post #37
post #34

Earlier quoted context omitted.

My gripe with json is the lack of support for comments. Whenever I come across a config file that has comments about what the config line(s) mean, I am so grateful. Whenever I come across a json config file, I kind of despair a little and start poking at the code in hopes there are comments about what the config means.

I totally agree with your gripe about JSON's lack of comments. There were people AFAIK who tried to write a spec with comments (and maybe dangling commas? was it called JSON5?) but by then it probably was too late.

My biggest issue with JSON5 is as far as I'm aware, if you update settings programmatically, you tend to lose comments... not sure of any implementation that preserves them.
Post reply on HN