Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
OddObserver
Apr 3, 2009

Blue Footed Booby posted:

I'm sure it 's like all languages in that you can take a sane subset of the language features and have something reasonable, but holy poo poo does it have some byzantine footguns. It's the closest I've seen to fantasy novels where wizards toy with forces they don't fully understand and end up eaten by demons or turned into owlbears.

That's in fact a perfectly acceptable thing to happen if you invoke undefined behavior!

Adbot
ADBOT LOVES YOU

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Blue Footed Booby posted:

I'm sure it 's like all languages in that you can take a sane subset of the language features and have something reasonable, but holy poo poo does it have some byzantine footguns. It's the closest I've seen to fantasy novels where wizards toy with forces they don't fully understand and end up eaten by demons or turned into owlbears.

This is the best summary of C++ programming I've seen. The language has evolved in the last decade to make it much easier to program without running into the footguns, but there's a lot of legacy that's going to make it hard to completely get rid of them.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Xerophyte posted:

Is the thing that if it were to be implicitly converted to the opposite integral/floating type then the converted type would be materialized as a bindable prvalue, and since implicit conversions can happen when needed that ends up being the only valid thing the compiler can do?

Yep, that’s it exactly. You can’t pass an int l-value as an int &&, but you can convert it to float and pass it as a float &&.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

pokeyman posted:

Bigger scandal imo is that you don't have to return from main when declaring it as returning an int. What is the point of that?

Usually the answer to this would be "well it's what they accidentally implemented back in the 70s", but main implicitly returning 0 is actually something which originates in C++ and then was added to C later. The original reason is seemingly lost to time.

Foxfire_
Nov 8, 2010

CPColin posted:

I'm so happy I never have any idea what's going on in the C++ horrors.

Quick, someone post some perl!

Doom Mathematic
Sep 2, 2008

Foxfire_ posted:

Quick, someone post some perl!

Perl code:
#!/usr/bin/perl

# begincheck

print         "10. Ordinary code runs at runtime.\n";

END { print   "16.   So this is the end of the tale.\n" }
INIT { print  " 7. INIT blocks run FIFO just before runtime.\n" }
UNITCHECK {
  print       " 4.   And therefore before any CHECK blocks.\n"
}
CHECK { print " 6.   So this is the sixth line.\n" }

print         "11.   It runs in order, of course.\n";

BEGIN { print " 1. BEGIN blocks run FIFO during compilation.\n" }
END { print   "15.   Read perlmod for the rest of the story.\n" }
CHECK { print " 5. CHECK blocks run LIFO after all compilation.\n" }
INIT { print  " 8.   Run this again, using Perl's -c switch.\n" }

print         "12.   This is anti-obfuscated code.\n";

END { print   "14. END blocks run LIFO at quitting time.\n" }
BEGIN { print " 2.   So this line comes out second.\n" }
UNITCHECK {
 print " 3. UNITCHECK blocks run LIFO after each file is compiled.\n"
}
INIT { print  " 9.   You'll see the difference right away.\n" }

print         "13.   It only _looks_ like it should be confusing.\n";

__END__

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.
That's the most legible perl example I've ever seen, and my first reaction after going through all that was :suicide:

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

I wanted to send poo poo up some metrics to elasticsearch's APM, so I installed their .NET client. It worked fine and the data was good, but it defaulted to verbose logging and absolutely spammed my logs with tens if not hundreds of lines per second as it meticulously documented everything it was measuring.

No worries, there's a setting to raise the minimum log level... ok it's not a typed object, it's a key-value it can fetch from either environment variables or an IConfiguration object. Whatever, at least it provides constants for the keys... aaand it doesn't work, no matter which method I use.

Ok, let's check out the source code to see how it's reading its configuration, I'm guessing they kept things pretty simple...

FOURTEEN CLASSES, MULTIPLE INHERITANCE LEVELS AND TWO _THOUSAND_ loving LINES OF CODE just so it can read some ~thirty atomic parameters from extremely simple key-value objects :stonk:

Anyway, it goes balls deep into Microsoft's DI framework mentality with the result that I would have had to gently caress around hard with a custom ILoggerFactory in order to just properly set a minimum log level that only applied to the APM output. I said 'gently caress it' and just set a Serilog filter downstream.

NecroBob
Jul 29, 2003

I feel like this is closest thing I've ever read to a humorous anecdote or joke in executable form.

It somehow gets even more amusing as you read through it.





That said, I've never been so happy to have not touched Perl in over a decade.

Gaukler
Oct 9, 2012


NihilCredo posted:

I wanted to send poo poo up some metrics to elasticsearch's APM, so I installed their .NET client. It worked fine and the data was good, but it defaulted to verbose logging and absolutely spammed my logs with tens if not hundreds of lines per second as it meticulously documented everything it was measuring.

No worries, there's a setting to raise the minimum log level... ok it's not a typed object, it's a key-value it can fetch from either environment variables or an IConfiguration object. Whatever, at least it provides constants for the keys... aaand it doesn't work, no matter which method I use.

Ok, let's check out the source code to see how it's reading its configuration, I'm guessing they kept things pretty simple...

FOURTEEN CLASSES, MULTIPLE INHERITANCE LEVELS AND TWO _THOUSAND_ loving LINES OF CODE just so it can read some ~thirty atomic parameters from extremely simple key-value objects :stonk:

Anyway, it goes balls deep into Microsoft's DI framework mentality with the result that I would have had to gently caress around hard with a custom ILoggerFactory in order to just properly set a minimum log level that only applied to the APM output. I said 'gently caress it' and just set a Serilog filter downstream.

Every loving elastic project is full of this garbage. I wanted to create a new *beat to log from an app that logs via a shared memory segment (a different wtf) and in order to create a new beat, you have to run a go app that scaffolds another go app, and the resulting repo is 90mb of semi-vendored bullshit that looks like you accidentally opened a junior devs first enterprise Java project. I’ve seen people reinvent java in go, but the beats take it to a new level.

Soricidus
Oct 21, 2010
freedom-hating statist shill

NecroBob posted:

I feel like this is closest thing I've ever read to a humorous anecdote or joke in executable form.

It somehow gets even more amusing as you read through it.





That said, I've never been so happy to have not touched Perl in over a decade.

the only one of those I’ve ever seen anyone use is BEGIN

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

Gaukler posted:

I wanted to create a new *beat.

want this to be like swatch time

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Soricidus posted:

the only one of those I’ve ever seen anyone use is BEGIN

I've used BEGIN and END in command line Perl scripts

Soricidus
Oct 21, 2010
freedom-hating statist shill

Munkeymon posted:

I've used BEGIN and END in command line Perl scripts

I can imagine using END but pretty much all the likely cases are covered by }{

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Whatever happened to perl that looked like !@(*#$$&^%!^)@#!$"&!@#*$&^@#*

Hughmoris
Apr 21, 2007
Let's go to the abyss!

taqueso posted:

Whatever happened to perl that looked like !@(*#$$&^%!^)@#!$"&!@#*$&^@#*

Perl code:
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
That only won 2nd prize.

Impotence
Nov 8, 2010
Lipstick Apathy

Hughmoris posted:

That only won 2nd prize.

Well yeah, there's still readable text. Backwards is nothing

Jewel
May 2, 2009

ohhh no https://twitter.com/racheltrue/status/1365461618977476610?s=21

Volte
Oct 4, 2004

woosh woosh
Smells like YAML

Xerophyte
Mar 17, 2008

This space intentionally left blank

Volte posted:

Smells like YAML

Someone commented that rather than get Apple to fix the problem it will probably be easier for her to change her last name, which is true in many ways.

Dross
Sep 26, 2006

Every night he puts his hot dogs in the trees so the pigeons can't get them.

Xerophyte posted:

Someone commented that rather than get Apple to fix the problem it will probably be easier for her to change her last name, which is true in many ways.

Change her last name to a bool?

NtotheTC
Dec 31, 2007


Xerophyte posted:

Someone commented that rather than get Apple to fix the problem it will probably be easier for her to change her last name, which is true in many ways.

Rachel 1==1

Macichne Leainig
Jul 26, 2012

by VG

NtotheTC posted:

Rachel 1==1

Rachel !False

FlapYoJacks
Feb 12, 2009

Protocol7 posted:

Rachel !False

Rachel nullptr

xtal
Jan 9, 2011

by Fluffdaddy

Protocol7 posted:

Rachel !False

!!Rachel

Khorne
May 1, 2002
On the topic of name parsing horrors, I have a friend with "porn" in their last name and they have difficulty registering at a number of sites. Including government sites for important stuff.

While I can understand social media filtering that out, a government site that never shows the name publicly checking against bad word filters just seems bizarre to me. One of the sites even required SSN to register so you'd think they'd just pull SSN data and use that or something, but instead no it just rejects the name.

Volte posted:

Smells like YAML
I've seen true/false stored as strings in JSON more times than I can count. I've similarly seen thousands of lines of abstraction around standard json parsing libraries that would screw this name up in an instant.

I wouldn't bet against YAML, though. Can't believe a fragile, complicated DSL caught on as a configuration format for the simplest stuff. While I'm talking about things I can't believe, JSON not having comments or multiline strings...

Khorne fucked around with this message at 18:58 on Mar 6, 2021

FlapYoJacks
Feb 12, 2009
Any programmer that doesn't cast name fields to strings deserves whatever happens to their poo poo.

Double for key/value pairs in JSON objects.

Dylan16807
May 12, 2010

Khorne posted:

I wouldn't bet against YAML, though. Can't believe a fragile, complicated DSL caught on as a configuration format for the simplest stuff. While I'm talking about things I can't believe, JSON not having comments or multiline strings...

JSON5 seems like a solid option as a simple format with less annoyances.

It adds unquoted keys, trailing commas, comments, multiline strings, and slightly more flexible numbers. No new types.

Volguus
Mar 3, 2009

DoomTrainPhD posted:

Any programmer that doesn't cast name fields to strings deserves whatever happens to their poo poo.

Double for key/value pairs in JSON objects.

Any programmer that has separate fields for first name and last name deserves whatever happens to their poo poo. It's 2021 for crying out loud, really we should let go of this antiquated concept. People may have names, that's all, it's a string of zero or more characters. Done. There is no need to split poo poo up.

FlapYoJacks
Feb 12, 2009

Volguus posted:

Any programmer that has separate fields for first name and last name deserves whatever happens to their poo poo. It's 2021 for crying out loud, really we should let go of this antiquated concept. People may have names, that's all, it's a string of zero or more characters. Done. There is no need to split poo poo up.

Yeah, agreed. Except it's a string of 1 or more characters.

CPColin
Sep 9, 2003

Big ol' smile.
The horse I've been through the desert on would beg to differ.

Jazerus
May 24, 2011


Volguus posted:

Any programmer that has separate fields for first name and last name deserves whatever happens to their poo poo. It's 2021 for crying out loud, really we should let go of this antiquated concept. People may have names, that's all, it's a string of zero or more characters. Done. There is no need to split poo poo up.

hard to do when existing systems, both digital and institutional, expect first/last and it's impossible to programmatically split the name for that purpose without opening up a whole new can of worms

Sistergodiva
Jan 3, 2006

I'm like you,
I have no shame.

Just burn everything and start anew. If it's something I've noticed is that the larger and more important a company/software the worse it is.

omeg
Sep 3, 2012

Sistergodiva posted:

Just burn everything and start anew. If it's something I've noticed is that the larger and more important a company/software the worse it is.

Legacy code! :v:

Tei
Feb 19, 2011

Dross posted:

Change her last name to a bool?

Carbon dioxide
Oct 9, 2012

Since I got my own domain name, I gotten in the habit of using something like account-<website-im-registering-to>@<my-domain>.com as a way to easily filter poo poo and to know if someone leaks my e-mail address and doesn't tell me, who the culprit was.

I've ran into one or two websites that actually don't accept e-mail addresses with their own website name in it.

Impotence
Nov 8, 2010
Lipstick Apathy

Carbon dioxide posted:

I've ran into one or two websites that actually don't accept e-mail addresses with their own website name in it.

I have gotten banned from amazon for using amazon@

"includes an unapproved use of Amazon trademarked words, images, or reviews [...] An example of the above violation can be found here: amazon@domain"

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.

DoomTrainPhD posted:

Any programmer that doesn't cast name fields to strings deserves whatever happens to their poo poo.

Double for key/value pairs in JSON objects.
Most libraries don't give you that option, they just give you the types they guessed and if it's not what your object expects, well, that happens.

Volguus
Mar 3, 2009

DoomTrainPhD posted:

Yeah, agreed. Except it's a string of 1 or more characters.

Why non-empty? What's a valid reason for a person to have to have a name in a non-governmental system, not legal ID issuing program? It's not unique, it can change, it provides no useful information to anyone. A payment processor may require it and it can be asked at that time for that payment method, whatever that may be. It has no relation to the user of a particular account. If emails are being sent and the CEO requires for the email to start with "Dear XXX", then there can be a field that could ask how the person prefers to be addressed. It could be their name, if they have one, could be a nickname if they so prefer, it could be something completely different.

Jazerus posted:

hard to do when existing systems, both digital and institutional, expect first/last and it's impossible to programmatically split the name for that purpose without opening up a whole new can of worms

That's true, when you have to interface with dinosaur era system, you do what you have to do. But way too often we see newly created applications that are stand alone and ask for first and last name even though they really shouldn't have a need for it.

Adbot
ADBOT LOVES YOU

Presto
Nov 22, 2002

Keep calm and Harry on.

For anyone who reads the comic strip thread in BSS now I'm just imagining Everett True's reaction to this.

*Beats the poo poo out the iCloud manager* "Maybe next time you'll sanitize your inputs and stop inconveniencing customers with your incompetent programming!"

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply