top | item 47170294

(no title)

dmit | 4 days ago

  class Bean {
    private boolean sprouted;

    public void sprout() {
      this.sprouted = true;
      // ...
    }
  }
or

  data Bean = Dormant | Sprouted
  
  sprout :: Bean -> Bean
  sprout Dormant = Sprouted
  sprout Sprouted = -- aw, beans, we could have modeled
                    -- this state as impossible to construct,
                    -- but you chose runtime checks, so
                    -- here we are.
As for pointing to the source line, I think JavaScript people solved that one for us with source maps. Just because we download and execute a single 4Mb line of minified code, doesn't mean we can't tell which line of the original source caused the error. :)

discuss

order

phailhaus|4 days ago

Oh lord, yeah this convinces me even more that this is a bad idea. I can't even tell at a glance if those do the same thing. Just pick one and move on, you're requiring everyone to pass around sourcemaps literally everywhere they go, one for every single pair of syntaxes. You can't even talk about the code with the same language with each other. Is Bean a "class" or a "datatype"? If I'm using one syntax, how do I tell you to fix a bug in your syntax?

dmit|4 days ago

> If I'm using one syntax, how do I tell you to fix a bug in your syntax?

How about "Hey, your Bean ain't sprouting"? :)

I'm sorry, I feel like I'm not communicating this properly. Um, have you ever discussed with someone a book or a TV show that was translated into your language? Did you have problems referring to the exact parts you liked or disliked? :)