Threads for gnubison

  1. 3

    The examples in “2. Raku with sigils” are @foo[5] %foo<key> &foo() but the reader seems to get the same context from just foo[5] foo<key> or foo(). Other languages have no problems with interpolation without sigils. I’m not going to avoid a language because it has these but they don’t seem to add much value.

    1. 1

      I agree that the sigil in @foo[5] doesn’t communicate anything. The point I was attempting to make is that the sigil in @foo communicates that I can write @foo[5] (or other code that expects to be handed an ordered, numerically-index-able collection). Does that make a bit more sense/seem more useful?

      1. 1

        As an author the IDE knows the context so the sigil is not providing much added value. As a reader the text after the variable provides the context and the IDE has it also.

        1. 4

          Regardless of the merits of sigils or not (I am not personally convinced but can see why others would hold such an opinion) it is important for conversations about languages to by upfront about whether there is a separation between the programming language from the IDE.

          For many programmers, there is no separation: languages that do not have IDE autocomplete are useless. For some programmers the IDE is fundamentally divorced from the language. C didn’t need an IDE. But then Java absolutely does. Unison takes it one step further essentially has a coding assistant running at all times that you ask questions of to figure out what you want to do.

          TL;DR I think the OP is not considering IDEs in the conversation and you are, and this leads to different conclusions neither of which is necessarily off-base.

          1. 1

            Good point. In the walled off context the author sets they make their point. Considering sigils in the wider context of programming practice includes IDEs and I don’t see as Raku an academic research project language.

          2. 2

            Even if your IDE can show you context on a mouse-over, isn’t there a little value in a compact (just a single character), mandatory (at least in Perl) type indicator which you can always see? The nice thing about sigils is that they’re there whether you use ed, print out your code, or just have your hands off the keyboard and mouse.

      1. 11

        I think a better analogy for variable sigils is noun inflections. Indeed there is a direct parallel between @ and plural markers like English’s -s:

        • They can add information. For example if you say “my apples” you’re conveying the information that you have at least 2 apples. In Raku (and Perl) if you declare a variable with @ you’re saying there are multiple items (which could be 0 or 1 item).

        • When they don’t add information they are still required. For example, in “two apples” the -s adds no new information, but it is still required (“two apple” is ungrammatical). In Raku (and Perl) you always have to refer to a variable with the sigil, even when the name itself is unambiguous. (As the article said it’s possible to create sigilless variables, but the “social norm” is such that you’ll use sigils).

        I find the analogy with $day_job and #hashtag a bit flawed, because the sigils in $day_job and #hashtag definitely add information, while Raku sigils don’t always do that.

        Noun inflections are not strictly necessary, and personally, as someone building a language with the $ sigil (shameless plug for Elvish) I think sigils make much more sense in languages that also support unquoted strings (also known as barewords): you need a sigil to disambiguate echo PATH and echo $PATH.

        Perl has unquoted strings (even though long deprecated) so need sigils too. AFAIK Raku doesn’t support unquoted strings, but it inherited the sigil system from Perl (albeit a somewhat rationalized version, for example indexing @a is @a[1], not $a[1]).

        All these said, if you grow up speaking a language with noun inflections, you’ll find it weird to not have them. Indeed if you look at recent artificial languages (human languages, not programming languages) invented by Europeans, they tend to have very few inflections except for a plural suffix, despite it being more rational to do away with all inflections (and use a word meaning “multiple” to make the distinction when absolutely necessary). I feel the author and many other Raku and Perl users probably have a similar relationship with sigils. I don’t mean this in a bad way: programming languages don’t have to be 100% rational, they can have quirky cultural attributes that appeal to some but not everyone.

        1. 4

          I like this take. I would say, the justification for $a[0] is that the sigil is for the output, not the input — i.e., you get a scalar output value with $a[0], unlike @a[0, 2, 5] which gives you a list. This is analogous to “my first apple”: it’s derived from “my apples” but the noun inflection shows what is “returned”.

          1. 0

            Reminds me of Lingua Romana Perligata - maybe if you have a properly inflected language then you can abandon sigils…

          1. 4

            I’m surprised there wasn’t a “technical writing” tag or similar.

            I’m looking at mdoc to generate man pages and an html page for sr, my spaced repetition program. I think having a manual page locally accessible is great and consistent formatting is even better. Makes me wonder actually why more haven’t adopted this or extended it carefully…!

            1. 1

              My impression is that many projects use the -man macro package because … many other projects use the -man macro package. For example, the Linux man-pages project:

              New manual pages should be marked up using the groff an.tmac package described in man(7). This choice is mainly for consistency: the vast majority of existing Linux manual pages are marked up using these macros.

              Which is a shame, because they suck. They’re harder to write, make for uglier source code, and have worse output.

              The BSD folks have seen the light, though. Take a look at their manual pages for role models. No SCREAMING_CASE_FOR_EVERY_ARGUMENT; synopses that help you use the program; typographically correct ‘’ curly quotes instead of straight quotes or, god forbid, ` and '.

              It’s hard to go back.