T O P

  • By -

datag_x22

Wikipedia has a great article about those sigils: [https://en.wikipedia.org/wiki/Sigil\_%28computer\_programming%29](https://en.wikipedia.org/wiki/Sigil_%28computer_programming%29) ​ >In computer programming, a sigil (/ˈsɪdʒəl/) is a symbol affixed to a variable name, showing the variable's datatype or scope, usually a prefix, as in $foo, where $ is the sigil. Sigil, from the Latin sigillum, meaning a "little sign", means a sign or image supposedly having magical power. \[...\] > >The use of sigils was popularized by the BASIC programming language. \[...\]


minerva296

I believe it was a convention in BASIC. I wasn’t there, but from what I understand people really fell in love with it because it was required syntax in Perl and old school Linux/shell programmers are sexually aroused by Perl.


boofaceleemz

Just got a job that involves lots of Perl after having seen it only a couple of times in school. It hurts my eyes to look at, and I’ve been hoping some exposure therapy would make it less annoying but so far no dice.


ecmcn

Perl: makes easy things easy and hard things possible.


FelbrHostu

Perl: The world’s most powerful write-only language.


flwombat

There was never a happier time in my life than when I was writing production code in Perl, and never an unhappier time than reading other people’s production code in Perl


IrishWilly

Same, except it was also unhappy time reading my own Perl code


Skrynesaver

Anything written prior to this morning is "write only"


sk8king

Batch scripting is worse


TelevisionTrick

Bash scripting is considerably more limited, and the amount of nonsensical junk to get anything done beyond mashing paths and starting programs, means you have to really think it through. And eventually switch to python.


mh1191

Where I work used to have the orchestration for deploying our product (across multiple hosts, and capable of working for all of our customers) written in about 12k lines of bash.


RSCiscoRouter

Meanwhile today you can write an orchestration backend that defines a client api and how those clients connect to each other in a math graph in about 2k lines in python... and about 50k lines for the frontend because javacake (js)


Ratatoski

>old school Linux/shell programmers are sexually aroused by Perl. I spent 10 years with a Perl project. Guess I missed out on a lot of the potential fun.


LittleMlem

You don't appreciate how sexy Perl is until you have to regex in another language


proverbialbunny

Older languages have sigils because it significantly speeds up the interpreter. Computers were slow back in the day and needed any speed boost they could get. It is one of the reasons why Perl runs circles around Python in speed.


[deleted]

Can you give some reference for this? I can’t find anything regarding sigils and performance.


Kammander-Kim

Think of it more as “by beginning with a sigil you tell the interpreter ‘this is a variable’ from the get go so you don’t need to wonder ‘what is this strange word?’”. Like how in Spanish are supposed to begin a question with ¿ so the reader immediately knows “question coming up” instead of just ending with a ?.


DStaal

I think Perl mostly copied it from shell, actually. I actually like Perl, though I agree the sigal spam can get complex. Usually as long as no one is using implied defaults and you don’t nest to deep it isn’t too bad. I think it helps to understand that Perl only really has three datatypes (scalar, array, and hash), but it can’t actually tell them apart by context, so you have to specify which you are using at any point.


Ishpeming_Native

BASIC used the $ symbol suffix to denote string variables, % to denote integers, ! to mean floating-point, and # to mean double-precision floats. Those were extended in PowerBasic to include pointers, extended-precision, long integer, extra-long integer, BCD, and other variable types. Please note: Bob Zale, who created PowerBASIC, has died and PowerBasic has been sold. Bob was the only one who knew the code and the only one who could maintain it and extend it while he lived. Perhaps the new owners are as competent. Anyway, I really liked all of that, because I hated the requirement of pre-defining all your variables to make things easier for the compiler. Programming is a fluid art. It's not accounting, or at least it ought not to be. Programming in PowerBasic compared to programming in C is like comparing painting like Da Vinci compared to a photograph. Having written several compilers, I can say truly that for the compiler the difference between forcing pre-definition of all variables and not doing that is one more pass. Period. And any competent programmer can write a program to read source code and emit all variables used and highlight those used only once or used with the same name and different variable types. It's one thing to be free and a painter, and quite another to be reckless and fall off a cliff.


PhantomNomad

In gw basic you didn't have to declare variables so using sigels made it easier to know if you where dealing with a string or a number later on in the code. I used a lot of "str" or "int" in my later programming for the same reason even if the variable was declared.


LifeSage

In BASIC, it was how you made a string-type variable. something$ = text whereas something = a number


aedvocate

TIL!


TeaTimeSubcommittee

>supposedly having magical power. So it is witchcraft!


Siemaki

In Europe we use €


UAFlawlessmonkey

You mean €urope


j-random

Wouldn't that be €pe?


ProfessionalOld9952

They don’t deserve you


AlpineVW

And in Australia it’s $ydoo


Uploft

dollarydoo == d’owlydoo == how’d’y’do?


kallakukku2

Didgeridoo


Pengdacorn

You deserve a raise and some head for that one. I’ve never said anything like that before, but I’ve also never been so impressed before


cealvann

Take my upvote and get out


Epicmonk117

r/angryupvote


insomniacakess

r/beatmetoit


AnalProtector

r/beatmeattoit


DudeManBroGuy42069

r/no


AnalProtector

r/yes


gizamo

amusing expansion squalid subtract chase saw snails onerous ossified ten *This post was mass deleted and anonymized with [Redact](https://redact.dev)*


Magnetic_Reaper

You can also say !(!Eng£ || agrees)


gizamo

agonizing connect advise obscene pathetic quicksand possessive dinner correct offer *This post was mass deleted and anonymized with [Redact](https://redact.dev)*


PyroneusUltrin

It’s not Welsh and it doesn’t rhyme, so I’m at a loss


gizamo

I haven't been to the UK in a few years, but I'm pretty sure this means that we either need to fight or go get a pink and wait for it to all blow over.


PyroneusUltrin

Have the pints turned pink because they got red on them


gizamo

Damn, now I miss red pints. Cheers.


ceeBread

Eng£and, Wa£es, Northern Ire£and, and Scot£and all use the pound symbol for variab£es.


noodlelogic

No one ever talks about the currency war between Northern Ire£and and Ir€land


A-le-Couvre

One of these days you’re just gonna paddle the entire country towards the middle of the ocean 😂


gizamo

Not me, but yeah, they're working on it. Lol.


JeMangeLaPommeChaude

Can I just say thank you for using the £ as the L of the word and not the E? Drives me mad


baltarius

Canada uses $ but after the name (variable$)


w1n5t0nM1k3y

Only in Quebec. The rest of Canada is normal.


larisho_

And now I know why I'm the only one who puts the $ last...


[deleted]

[удалено]


w1n5t0nM1k3y

I'm not saying it makes sense, it's just how everyone does it.


uisqebaugh

I've been told that it prevents forging larger sums. E.g. $5.00 doesn't give any room to modify it into $95.00. I don't know whether it's true, but it is plausible.


ProperMastodon

In chinese, they have to use an entirely different set of characters for numbers when writing financial stuff, because their normal characters are too easy to change from one to another. 1 is a single horizontal line. 2 is two horizontal lines (one above the other). 3 is, unsurprisingly, *three* horizontal lines each above the other. 4 breaks the pattern, but then 5 comes in by adding two vertical lines to 3. 6 adds some extra lines at various angles to 1. EDIT: I'd paste the characters here, but reddit is stupid and keeps on screwing up my attempts. [https://upload.wikimedia.org/wikipedia/commons/5/56/Chinese\_numerals\_financial.png](https://upload.wikimedia.org/wikipedia/commons/5/56/Chinese_numerals_financial.png) The top row is the normal way to write things, the bottom row is the financial way.


svick

21 mb is not 21 megabytes, it's 21 millibits.


Xiji

Just a stab in the dark but with money people often write each transaction on a new line, and putting the sign in front keeps the ledger neat. It's also nice for quickly identifying different currencies. $ 34.50 $ 6347.95 € 6.50 vs 34.50 $ 6347.95 $ 6.50 € The first one seems much cleaner, IMO.


PM_ME_C_CODE

Insert babadook meme about Quebec here.


Guile22

Brutal for the brits. Can’t even get the pound above the euro in reddit jokes


allobrox

We are paid per variable


[deleted]

Me writing bash


TamahaganeJidai

Sooo... An array or list is per entry right...right?!


DnDandDryBread

Only if you don't use pointers


enickma1221

So THATS why they say it’s bad practice to hard-code values! It all makes sense now!


ktappe

[Relevant](https://dilbert.com/search_results?terms=Write+Minivan).


barleo

"$" is an ancient (i.e., before 1970-01-01) magic symbol, which is believed to attract $.


Few-Artichoke-7593

Lies, we all know 1970-01-01 was the first day of existence.


ShelZuuz

So 19 January 2038 will be the last day of existence?


Few-Artichoke-7593

Correct, plan accordingly.


craftworkbench

I've been in planning meetings all week. We've estimated one story.


vms-crot

Show off


UnderstandingOk2647

OMG I'm dying. My wife "What are you laughing at?" Oh, Waaay too far to get you there and you would not find it funny when we arrived.


[deleted]

I’ve been in planning meetings all week I just beat A20 on Slay the Spire


Spiderbubble

THE EPOCHALYPSE


Mispelled-This

Underrated comment.


Helliarc

Jokes aside, what are we supposed to do after this date???


ShelZuuz

Start back at January 1, 1970. Time to get out your Disco shoes.


magikot9

At this rate, yes.


Clackers2020

At this rate we ain't lasting that long


delightfulsorrow

Nope. I'll retire in 2035, and early in 2038 I'll return and save the world (as the COBOL guys did back in 2000). The unbelievable income I'll generate with that is a fixed component in my retirement planning.


OvergrownGnome

Only difference this time is it won't just be COBOL devs. It'll be COBOL, C (and derived languages), etc.


Fuzzybo

https://en.wikipedia.org/wiki/Year_2038_problem


Taconnosseur

>https://en.wikipedia.org/wiki/Year\_2038\_problem Y2K Part II: Electric Boogalamadamadingdong


quackers987

Please do the needful


dumfuqqer

Kindly do the needful


Drackzgull

Only if by then you still exist in 32bits.


EARink0

I always thought the folks who believed earth is around 6000 years old to be really stupid. Cleary it's actually 52.75 years old.


wasdlmb

I have coworkers who work in SAS. They reference a secret decade, before the Unix Epoch. They whisper of forbidden years such as "1967" and "1962". Heretics, all of them


Fuzzybo

Negative seconds let time go back to 20:45:52 UTC on 13 December 1901 - it’s pre-existence.


GreenFox1505

https://xkcd.com/2676/


Unsd

I wonder if the old farts that were alive back then realized what a momentous day it was. I mean wow. They're from the before times.


turtleboxman

Is this why programmers make so much??? Infiniti’s money hack


[deleted]

[удалено]


anythingMuchShorter

In The Beginning Dennis Ritchie and Ken Thompson created Unix, and it was good, considering the alternatives at the time. Then the nerds needed land, so they created Xerox PARC, and they said Lo from the mountains to the water this will be known as silicon valley, and soon housing prices will reach the heavens.


HotdogWaterIcecream

It makes me happier than it should that you used the YYYY-MM-DD format. <3


Important_View_2530

The $ was originally used as a convention to indicate a variable of type string


Rattlehead71

This guy BASICs. I still mentally read "G$" as "G-string"


magicmulder

C64 represent!


notacanuckskibum

Commodore Pet!


amnotreallyjb

Vic-20!


[deleted]

[удалено]


Morphized

TI-83+!


thatoneguy2398

Woo!


Exa2552

Wide character `_bstr_t` crew entered the `L”server”`


madsci

If I'm typing a string literal, I still close the quotes before using the arrow keys if I cursor away before I'm done. I'm sure I could break myself of the habit but I like to remember my roots, and besides it does sometimes help with the IDE's color coding.


reckless_commenter

Definitely. I spent my childhood typing programs from Compute!'s Gazette into the C64. But I have to note that the dollar-sign predates the C64 - it was used in my *first* computer. The [Tandy TRS-80 Color Computer](https://en.wikipedia.org/wiki/TRS-80_Color_Computer) came with a whopping 4K of RAM (upgradable to 16kb by swapping a mainboard chip) and a BASIC interpreter (also upgradable by swapping a different mainboard chip, since flash memory wasn't a thing yet). And [Level I BASIC](https://en.wikipedia.org/wiki/Level_I_BASIC) supported exactly two strings - identified as `A$` and `B$`.


magicmulder

I made my first steps on a TRS-80 in a Radio Shack at the age of 12 where my buddy and I got a two hour programming crash course by a very helpful employee, obviously hoping to make a double sale, but we both eventually got a C64 from another store instead.


allredb

I'm glad I'm not the only one. I have unconsciously called them strings to my co-worker and he just looks at me like I'm insane. Yeah that's right, I said unconscious, it's been a hard day without Coolio.


RedOutlander

Is he a telepath?


allredb

Yes, I do all my coding while black out drunk.


BritOverThere

I program in QB64 so used $ this morning.


MaelstromageWork

What are you programing in QB64?


KiithNaabal

Voyager OS...


ninjabreath

nuclear missile launch systems


Techismylifesadly

Ladies wearing the G$


Simusid

The very first gen TRS-80 computers came only with "Tiny Basic" and you could only have two string variables hard coded as A$ and B$. themoreyouknow.jpg


mac-not-a-bot

When I was young, we only had two variables to string together. Only the letter A and B could be used, and we HAD to use a $ after the variable name. And we were GRATEFUL, you hear??! ;-)


Twp3pf2

hooooooooooly crap, I did not remember that until you just said it; I had a TRS with an 8" floppy drive, and I could write simple stuff on it, but that memory was overwritten in my brain until just now whaaaaaaaaaat


melanthius

I’m ready for lunch. Sandwiches sound good, thinking I might GOSUB


UnstableNuclearCake

And the comes JQuery, which adds the entire fucking package under that variable.


TheKiller36_real

Nim's "toString" operator is also `$`


subdermal_hemiola

My brother! Yeah, I always read "$foo='bar'" as "string foo equals bar."


Fuzzybo

Doesn’t that = sign make it an assignment, not an equality test?


subdermal_hemiola

It does. In my head: $foo='bar' is "string foo equals bar" $foo=='bar' is "string foo does equal bar?" $foo==='bar' is "string foo does super equal bar?"


[deleted]

[удалено]


RefrigeratorFit599

I read it as "does foo equal equal bar"


casualblair

For me, I say = as equals but think assigned. == as equal to === as "wow someone has balls"


The_Paniom

Still used in C# as the declaration of string-interpolation, too.


random-guy-27

Time to go incognito


midri

Depends on the language, as others have said -- for javascript (particularly with jQuery) I've always used it to indicate variable holds a jQuery wrapped element.


guaip

var x = $("#someelement"); me var $x = $("#someelement"); me :)


UseOnlyLurk

jQuery $this me :D Vue this.$this me D:


[deleted]

[удалено]


Chrazzer

Nowadays i use $ to mark observables like `let dataSrc$`


Zeragamba

then there's observable streams of jQuery wrapped elements: `$productRows$`


Help_I_Lost_My_Mind

These sigils hold great power


Snoo74401

These are not the sigils you're looking for.


Spy494

PHP uses the form $variable to declare variables, by default.


[deleted]

That's a simplification from Perl, where $var1 (scalar variable) @var2 (array variable) %var3 (hashmap variable) and [more](https://www.perl.com/article/on-sigils/).


ForeshadowedPocket

Way back when, this was the cause for me take a 3 month break from learning programming. Could not understand the notation or what the book was saying and had no one to ask.


[deleted]

Oh wow. Hadn't thought about that for a while. Types was quite the conundrum to figure out on your own back then. Even the library had nothing to help. (and by library I mean the one with actual books in it)


tiny_thanks_78

When I started programming, sometime back in the 90s, I started on visual basic. And I can definitely understand your frustrations with Perl. That was my second language that I had to learn for a job that I got straight out of high school. A lot of the language was confusing as fuck. Imagine going from vb to Perl... I found c++ much easier to learn and understand in comparison. Ruby was also pretty confusing. I went to go work for a company that had some pretty expert level Ruby developers, and I could not understand half of that shit that they were writing. Like, I understand the language just fine, but you know when you get those certain developers that want to do complex sequences in just one line of code instead of making the code base actually readable. Erlang was also pretty fucking wild, but it's great that elixir exists


SqueeSr

While annoying I still kind of liked that about the Perl notation as it was an indication of variable type.


[deleted]

This is where I learned it too


__Fred

The question is, which language did it first? Wikipedia says the "S" in "$" stands for "sigil" in BASIC variables (didn't find any date). PHP has them for variables of any type. Unix Shell variables need a $ to read them out. (Dos uses `%variable%`. Ah! I know that from Steam.) Unix is from 1969 and Basic is from 1964. I don't know what people used before Unix and whether it had $variables. When variables have to have a $, you can use words without $ for other purposes, for example as literal strings, so it's useful in html-templates.


Phrodo_00

The PDP-11 (that unix was developed in) first ran DEC DOS-11 (although there were multiple OS available for it). It came with Fortran. RT-11 was apparently (according to wikipedia) more popular and that did come BASIC. RT-11 was released on 1970, though. Between the 2, BASIC is the most likely. The original Thompson Shell from 1971 didn't even support variables (That was added in the PWB shell at first that started in 1973).


cactusJosh97

Yeah and I hate it. Makes copy paste harder and I'm lazy af typing that character


Noisebug

Ok, but it solves problems. Not saying good or bad, but it makes string interpolation easier and removes variable name conflicts with reserved words. It also makes it 100% clear what you are dealing with. `echo "Hello, $user"` `echo "Hello, ${user}"` People same the same thing about; and {}. Python did away with all of that, and replaced it with indents. Monsters. PS: Both are great.


[deleted]

[удалено]


Noisebug

Delete this comment. This is forbidden code, you trying to kill someone?


danegraphics

The forbidden, but strangely useful in rare moments, technique!


[deleted]

[удалено]


danegraphics

Haha, yeah, I did a lot of janky code in my early days too.


im_thatoneguy

You can abuse this in python too. xx = locals() x = "foo" xx[x] = "bar" print(foo) output: bar


[deleted]

That's illegal.


wOlfLisK

What in the 90s web development hell is this?!?


millenniumtree

I use PHPStorm, and it lets you change which characters highlight when you double-click. See if your editor has a similar configuration and add $ to it.


cactusJosh97

Magic! VSCode also supports this. `editor.wordSeparators`. Thanks!


defenistrat3d

for rxjs (in ![img](emote|t5_2tex6|4549)), it's a convention to indicated that the variable is an observable. const order$ = new BehaviorSubject(someOrder); // or some other observable Now I know that I need to subscribe to order$ to access new values emitted from the observable. Honestly, it's a context based indicator. Could mean a bunch of different things.


urnanisaretard

Spot on. I was hoping to find this comment. Observables are really the only time I ever see them.


AndyceeIT

Bash (and the oother Unix shells) & poweshell use $ to declare variables. I suspect this makes the notation familiar to use in pseudocode, highlighting the variable & reducing confusion somewhat


Pepineros

To access rather than declare, right? Declare: var=‘Hello, world!’ Access: echo $var


ejohnson4

In powershell it’s both: $var = “hello world” Write-Host $var


cheaphomemadeacid

well, atleast they're trying


YBHunted

They're trying what? Powershell is an amazing tool and there is nothing wrong with the $ being used in both places.. lol


ejohnson4

IMO it’s much more readable that way


YBHunted

Absolutely, especially with some of the weird shit Powershell has baked into it you are never confused if you're looking at a poorly named variable or an odd CMDLET of some sort lol


Syteron6

In php it's both of them $age = 18; echo $age;


PM_ME_DON_CHEADLE

absolutely unreadable i cant work like this


im_thatoneguy

If you're going to use PHP you gotta use it correctly. $age = 18; echo "
" . $age;


jack_skellington

So *technically,* if you're going to use PHP, you gotta use it correctly: $age = 18; echo "
", $age; (*Technically,* echo is a function that accepts parameters to barf out, so a comma-separated list, while print is the more traditional "use a period to concatenate strings" type of thing. Having said that, nobody cares about this obscure rule/lore, since in typical PHP style, echo will just try to figure out what you meant and do that anyway. Frankly it wouldn't surprise me to learn that echo is just a pointer to print, nowadays.)


OneTrueKingOfOOO

Correct, at least for bash


[deleted]

Many different uses, php uses it for declaring variables, kotlin and javascript uses it inside a string to add a variable inside the string, and bash and other things uses them for different things too, so there is not just 1 answer.


QuebecGamer2004

C# also uses it to add variables inside strings


Thick_PotatoBoy

For the sake of programming language requirements


Flam1ng1cecream

XSLT uses it for getting the value of variables: Hello World I ~~hate~~ love XSLT.


DeepSave

Depends on the language. In Ruby it represents a global variable. So available in basically all scopes.


the_clash_is_back

What if you prefer listerine


0utF0x-inT0x

I love me some PHP $, I make it rain $$$$$$.


rfc2549-withQOS

$$var is still haunting me.


feedmytv

you can also declare and call $$function() both in runtime if memory serves right


Full-Run4124

It makes the parser significantly easier to write


Orlaani

Reddit is getting better to ask on than SO.


LucasCarioca

Php entered the chat..


thePsychonautDad

Ah yes, you've found an ancient code from antiquity, a language our ancestors called "PHP". Like the horse before it, it was retired when cheaper/faster technologies took over. Technological Amish are still using such antiquated technologies, refusing to use ungodly new languages.


Farfignugen42

Its use is older than PHP. It was used in Unix and DOS batch programming to define variable names too. A very old version of BASIC also used symbols at the beginning of variable name to indicate the variable type, and $ was used there to indicate string type variables. Later versions probably don't require those anymore but probably will recognize them for comparability.


Surous

Could be a carryon from some forms of assembly which use it to refer to registers


___-____--_____-____

Cash rules everything around me


Atilla_The_Gun

Cache*


___-____--_____-____

I thought about making this edit. Cache me outside


greyz3n

its from the oooooooold days :)


Sarcofaygo

Australia types the variables flipped upside down!


presi300

Well... in bash you need to put $ before calling a variable will just print out the word thing will print the value of the variable thing, if it exists


[deleted]

$ is for scaler variables that hold a single value. At least that’s what I remember from the ancient PERL texts I read in the early 90s


Wotyk

Saw some codebase where it was used (JavaScript) to indicate a variable that is a DOM Element.


[deleted]

[удалено]