35 pointsby velcrovan7 days ago2 comments
  • 8n4vidtmkvmk5 days ago
    Lost me at the second sentence.

    > Why go to the trouble of designing clean, semantic markup if you’re just going to slap it all on one line that scrolls horizontally forever?

    Is this a formatter for authoring HTML, or for the HTML we send down to the client? Because the latter should be optimized for byte size. No one needs to read that.

    • neilv5 days ago
      It's a utility procedure that other people will use for various purposes.

      Sometimes you end up making a package for just one utility procedure, and sometimes there's a little levity in that documentation:

      https://www.neilvandyke.org/tabexpand-scheme/

  • behnamoh5 days ago
    I like Racket. I don't like Racket's excessive use of symbols: ( [ #:word? word->anotherWord ...

    Same goes for Haskell (https://tech.fpcomplete.com/haskell/tutorial/operators/).

    • neilv5 days ago
      I kinda agree.

      The `#:foo` syntax is something that Racket did when it introduced keywords values, to support keyword arguments. So, you'd write:

          (myfunc x y #:foo 42)
      
      when in some other languages you'd write one of:

          myfunc(x, y, foo=42)
      
          myfunc(x, y, foo: 42)
      
      Personally, I argued for the `#:` to be `:`, like in some other Lisps:

          (myfunc x y :foo 42)
      
      Regarding `->`, it's an ancient Scheme naming convention for identifiers, meaning transform one thing to another, which looks a little ugly, but not a totally bad idea. So you'd have:

          (number->string 42)
      
      rather than `numberToString(42)` or any of the other gazillion function names, methods, special syntax, idioms, or flying leap type coercion used in other languages.

      Scheme also has a few other conventions, including suffixing an identifier with a `?` to denote a predicate on a value, such as:

          (positive? 42)
      
      compared to, say, `isPositive(42)`.

      The Racket professors added their own conventions in code they write, including making `[` syntactically equivalent to `(`, and then having a convention of when to use bracket vs. parentheses.

      I actually privately made my own Racket `#lang` that permitted colon-keywords, and removed the square-bracket equivalence. There shall be no pound-colon-keyword, and I expect there's better uses for square brackets, such as for an heavy use object method/message syntax without having your code full of `send`. For example, instead of Racket's own object system syntax:

          (send myobj mymethodid x y)
      
      you might have:

          [mymethodid myobj x y]
      
      or:

          [myobj mymethodid x y]
      
      Or some other use in various PL research uses of Racket, where you have a language that starts as Scheme, and adds some other semantics for which you don't want special keywords throughout the code. Unused ASCII symbol characters are precious.
      • andrewflnr5 days ago
        > I actually privately made my own Racket `#lang` that permitted colon-keywords, and removed the square-bracket equivalence.

        That's gotta be one of the LISPiest things I've ever heard.

        (No disrespect. Godspeed, I wish I could follow.)

      • shawn_w5 days ago
        `#:name` style keywords are pretty common in Scheme implementations. I've grown to like the style; makes them stand out more visually. (Possibly uniquely, Chicken lets you choose between several different styles; :common-lisp, dssl: and #:sharp-colon)

        Making square brackets an alternative to parens is another thing I like (also supported by some Schemes and in R6RS but not R7RS). You don't see it as often but you can also use curly braces as another alternative. Hmm. Maybe they should borrow from perl¹ and have any pair of matched characters count.

        1: https://perldoc.perl.org/feature#The-%27extra_paired_delimit...

        • neilv5 days ago
          I don't know for certain, but I think Racket (PLT Scheme) started both of these. (Scheme implementors do tend to have a strong-minded side, but also tend to be aware of other implementations, and some are willing to borrow smaller details from other implementations, or at least to show they can support that too.)

          IIRC, one of the arguments for `#:` in Racket was that one of the SRFIs incidentally kludged `:` keywords for its own purposes, and someone didn't want to break that SRFI. :)

          • soegaard5 days ago
            I think the problem was that `foo:` is a legal symbol.

            That is, there were a potential backwards compatibility problem. That said, I wish we adopted the `foo:` style back then.

            Btw - since `foo:` is a legal identifier and references to unbound identifiers are rewritten to `(#%top . id)` one can write a custom `#%top` to any `id:` into `#:id` without making a new language.

            This technique is used in `scribble/html/main` for turning identifiers that end with colon into self-quoting symbols.

            • neilv5 days ago
              I like both `:foo` and `foo:`, and could've gone with either one.

              IIRC, Joe Marshall pointed out at the time that `:foo` means the colons line up nicely when you have a long form of keyword arguments, each one starting its own line. And one of those lines might have multiple lines dangling off it, but the lined-up colons and indentation help make the structure clear visually.

              Typed Racket later made use of colons on the ends of identifiers, like in `let:` and `lambda:`, to mean like the Scheme form, but with expressed types. (I might've tried to use square brackets for sprinkling optional type annotations. Such that a trivial syntax transform could go from typed to untyped, simply by removing square bracket forms, or by substituting a square bracket form with its first element.)

              Having Scheme code easy to type, and easy on the eyes, are two of the things that are important to me, though not the most important. I wondered whether the `#:` was insisted upon because someone didn't see code the same way I do, and thought that the people who objected were only bikeshedding about minor details. But it's a minor detail that was shredding the eyeballs of some of us throughout each day. :)