Hacker News new | past | comments | ask | show | jobs | submit login

> To enable static checking with srb, add this line (called a sigil) to the top of your Ruby file:

> # typed: true

Isn't this called a directive/pragma? A sigil is a symbol on a name.

Either way, I'm excited to see this finally out after seeing the past presentations on it.




Thanks for pointing that out. It can be called all of those. We liked sigil from its connotation:

> Google defines sigil as, “an inscribed or painted symbol considered to have magical power,” and we like to think of types as pretty magical

https://sorbet.org/docs/static#fn1


That's a pretty unintuitive use, since "sigil" is more commonly used (in programming languages) as a single symbol, as in a non-alphanumeric character that's used as some kind of syntax.

https://en.wikipedia.org/wiki/Sigil_(computer_programming)


Right so the $ in PHP or @ in Perl would be a sigil, (and even the $ and % in QBasic, am I dating myself?) and the # in this example and all C code and some Swift code would be a pragma. Seems pretty cut and dry.


And the $ and @ in ruby...


I remember there was this CEO once who was new to the software industry and was looking for a word to describe non-small-business customers. When people suggested "Enterprise", he instantly dismissed it, and when they insisted this is already the word we all use to mean this, he actually opened the dictionary to prove that it wasn't quite accurate. What I took from this is that, when cultures or conventions already have momentum, sometimes you just have to go with it. This is the same reason I don't like Go.


How does this relate to Go? That flew over my head.


They throw every convention out the window and act like they have a true greenfield audience. They don't even allow [variable, Class, CONSTANT] convention, they don't follow the convention of letting devs choose their own project location, and a lot more.


Could be a reference to Go choosing to use different words for similar concepts that exist in other languages like C++? I'm not familiar enough to think of examples though.


Bummer. That kind of name overloading has the potential to be needlessly confusing down the line. "Sigils, I mean well, they're like pragmas but in Sorbet we call them sigils." [x a billion]

Now's the time to fix that stuff.

(In any case, I'm quite keen to start playing with sorbet, looks great!)


  test/test_corpus.cc
  364:        auto checkPragma = [&](string ext) {
  368:                    << "Missing `# typed:` pragma. Sources with ." << ext << ".exp files must specify # typed:";
  377:            checkPragma("cfg");
A quick look at the source shows that it may have been called pragma at one point.

EDIT: I'm guessing "sigil" was chosen because it's closely matching the "signatures" or Sigil.sig method name?


Nice spelunking! Yeah, this word means nothing really. Sigil, pragma, directive, typed comment, whatever. Feel free to call it "dohicky" if you'd like.


Ruby has perl-like sigils, eg: @i_am_instance_var, $i_am_global. Additionally, one might consider array literals sigil-like (like %w[a b c d e f g]).

https://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/vari...


The terms all overlap a bit, but I would interpret "directive" or "pragma" to indicate that it's conveying meaning to the Ruby interpreter. This is exactly the opposite -- it's a comment as far as the Ruby language is concerned while conveying meaning to an external tool.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: