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
Xarn
Jun 26, 2015

Sebbe posted:

So, apparently PHP lets you redefine the VM opcodes... from within the language itself.

comment on that page posted:

Who thought this would be a great idea? This is insane.

I have nothing to add.

Adbot
ADBOT LOVES YOU

Space Kablooey
May 6, 2009


Sebbe posted:

So, apparently PHP lets you redefine the VM opcodes... from within the language itself.

why

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
"It's called monkeypatching. It's a little… look, it's a thing we do in Ruby for fun."

"Who can monkeypatch the most? You guys are real crazy, hey look out for these guys. Hell I can monkeypatch. For twenty bucks I'll patch VM opcodes at runtime!"

"Woah, woah, Rasmus- calm down-"

"Ok, ZEND_EXIT, Chickenfuckers!"

Munkeymon
Aug 14, 2003

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



Xarn posted:

I have nothing to add.

Yeah which one of you guys was that?

Karate Bastard
Jul 31, 2007

Soiled Meat

Truth posted:

Who thought this would be a great idea?

Is that really a question that you have to ask?

Karate Bastard
Jul 31, 2007

Soiled Meat
Speaking of ruby, go here:

https://github.com/Shopify/liquid/issues/216

Scroll down / find "CEO Shopify" on oage.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Sebbe posted:

So, apparently PHP lets you redefine the VM opcodes... from within the language itself.

Good news is that it's not actually built into the language; it's an extension.

https://github.com/krakjoe/uopz

return0
Apr 11, 2007

IT BEGINS posted:

Small dev horror. Asked one of our senior devs to pair with the new guy to work on adding a feature to our 'remote' authentication. Asked him to also test drive it or at least cover it so some of the guys that are new to testing have a real example to look at.

Got told "it will only confuse the new guy" and "it's a terrible specimen to test" because it requires "heavy mocking of the incoming request". :doh:

Sounds like the senior dev has correctly identified the horrors of test-first.

IT BEGINS
Jan 15, 2009

I don't know how to make analogies

return0 posted:

Sounds like the senior dev has correctly identified the horrors of test-first.

Maybe. Then again, it's not getting tested at all now, soooooooo

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Sebbe posted:

So, apparently PHP lets you redefine the VM opcodes... from within the language itself.

Not really, uopz is basically a VM introspection module, it's not part of the core language. It's like linking gdb into your program and saying C lets you change values in other stack frames.

NihilCredo
Jun 6, 2011

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

I think I'll start posting tiny horrors from our production codebase once per day and see how long these ~70k LoCs keep delivering.

Let's start with a classic. How do you check if a Decimal variable is negative?

Answer: If quantity.ToString().Substring(0, 1) = "-" Then ...

Xarn
Jun 26, 2015

NihilCredo posted:

I think I'll start posting tiny horrors from our production codebase once per day and see how long these ~70k LoCs keep delivering.

Let's start with a classic. How do you check if a Decimal variable is negative?

Answer: If quantity.ToString().Substring(0, 1) = "-" Then ...

Classic

VikingofRock
Aug 24, 2008




Maybe they couldn't just use regular comparison operators because they were really concerned about negative zero?

(I have no idea how negative zero works with .toString())

I would blow Dane Cook
Dec 26, 2008
There's a negative zero?

comedyblissoption
Mar 15, 2006

NihilCredo posted:

I think I'll start posting tiny horrors from our production codebase once per day and see how long these ~70k LoCs keep delivering.

Let's start with a classic. How do you check if a Decimal variable is negative?

Answer: If quantity.ToString().Substring(0, 1) = "-" Then ...
maybe the correct behavior also includes the additional requirement that we should never consider the decimal equivalent to a negative number if the current culture setting does not use a prefix "-" to indicate a negative number, you phillistine

Linear Zoetrope
Nov 28, 2011

A hero must cook

Jumpingmanjim posted:

There's a negative zero?

In IEEE floating point, yes. Though by specification it == compares with positive 0 as true. (dividing by it produces negative infinity instead of infinity, though).

Pavlov
Oct 21, 2012

I've long been fascinated with how the alt-right develops elaborate and obscure dog whistles to try to communicate their meaning without having to say it out loud
Stepan Andreyevich Bandera being the most prominent example of that

Jumpingmanjim posted:

There's a negative zero?

I'm pretty sure there was some old hardware that did.

e: beat

Kazinsal
Dec 13, 2011

Jumpingmanjim posted:

There's a negative zero?

Sure is. Have an exponent of zero, a mantissa of zero, and a negative sign, and you get a float that's negative zero.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

FamDav posted:

someone who knows nothing about han unification: it was about saving space
someone who knows a bit about han unification: it was about white people not giving a poo poo about asians
someone who knows a bit more about han unification: it was about saving space, but also white people not giving a poo poo about asians

No Han unification may have meant no Unicode at all. Nobody would have accepted exploding text size 4x or a variable-length encoding in the early '90s

feedmegin
Jul 30, 2008

Pavlov posted:

I'm pretty sure there was some old hardware that did.

e: beat

As you note, old hardware using one's-complement (CDC 6000) or sign-magnitude (early IBM gear) could also have negative zero for integers.

ErIog
Jul 11, 2001

:nsacloud:

hackbunny posted:

No Han unification may have meant no Unicode at all. Nobody would have accepted exploding text size 4x or a variable-length encoding in the early '90s

Unicode is a variable length encoding (except for UTF-32), and it's not like anybody on the committee would have had to deal with exploding text size that much since Unicode was built to be compatible with ASCII.

ErIog fucked around with this message at 14:05 on Oct 21, 2015

canis minor
May 4, 2011

Kazinsal posted:

Sure is. Have an exponent of zero, a mantissa of zero, and a negative sign, and you get a float that's negative zero.

It's even used!

Type into your browser's console: -Math.pow(10, -10000);

Although:

> -0 == 0
true

> -0 === 0
true

edit:

>1/-0
-Infinity

>1/0
Infinity

>Infinity == -Infinity
false

>Infinity === -Infinity
false

:v:

canis minor fucked around with this message at 16:54 on Oct 21, 2015

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

ErIog posted:

Unicode is a variable length encoding (except for UTF-32), and it's not like anybody on the committee would have had to deal with exploding text size that much since Unicode was built to be compatible with ASCII.

Sure, it is today. But in 1992, it was a fixed-width two-byte encoding.

Athas
Aug 6, 2007

fuck that joker

ErIog posted:

Unicode is a variable length encoding (except for UTF-32), and it's not like anybody on the committee would have had to deal with exploding text size that much since Unicode was built to be compatible with ASCII.

He is talking about the early days of Unicode, where everyone assumed it was (potentially) fixed-width.

Sedro
Dec 31, 2008

Jsor posted:

In IEEE floating point, yes. Though by specification it == compares with positive 0 as true. (dividing by it produces negative infinity instead of infinity, though).
There was a .NET bug where struct equality was implemented as a memcmp, so your struct with -0.0f was not equal to your struct with 0.0f

ExcessBLarg!
Sep 1, 2001

hackbunny posted:

Nobody would have accepted exploding text size 4x or a variable-length encoding in the early '90s
IBM and X/Open were already down the path of using a variable length encoding for Unicode in 1992 when Ken Thompson and the Plan 9 folks derived and implemented UTF-8. UTF-8 was and is a fantastic idea, but what made it great at the time was backwards compatibility with ASCII. One of the big problems, at the time, is that many systems used or assumed 8-bit encodings and (what became) UCS-2 was not backwards compatible. That was a bigger problem than using a variable-length encoding. Many of those systems, if they use Unicode at all, use UTF-8 today and happily support emoji or whatever.

The other problem is that Windows NT and Java, brand new systems, came out at the time when most folks were on board with Unicode solving the world's problems but it had not yet exceeded the BMP. It was relatively simple to build new systems around UCS-2 even if they should have known better. Of course, now, Unicode has expanded beyond what UCS-2 can support, and UTF-16 is a variable length encoding, not backwards compatible with ASCII, weirdly implements surrogate pairs, and is generally a mess to deal with. UTF-8 is still great.

EssOEss
Oct 23, 2006
128-bit approved

Sedro posted:

There was a .NET bug where struct equality was implemented as a memcmp, so your struct with -0.0f was not equal to your struct with 0.0f

When you say was do you mean it was changed? I thought this was still the case.

xzzy
Mar 5, 2009

ExcessBLarg! posted:

Many of those systems, if they use Unicode at all, use UTF-8 today and happily support emoji or whatever.


Too bad the display fonts haven't caught up. :v:

Munkeymon
Aug 14, 2003

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



I pasted https://codepoints.net/U+1F4A9 into Visual Studio the other day and was pretty surprised when it worked.

Sedro
Dec 31, 2008

EssOEss posted:

When you say was do you mean it was changed? I thought this was still the case.
It might still be true

NihilCredo
Jun 6, 2011

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

Munkeymon posted:

I pasted https://codepoints.net/U+1F4A9 into Visual Studio the other day and was pretty surprised when it worked.

https://dotnetfiddle.net/qOkMCD

I'd have pasted it but the F# compiler apparently has better Unicode support than the SA forums.



NihilCredo fucked around with this message at 22:25 on Oct 21, 2015

xzzy
Mar 5, 2009

The forums "support" it just fine. You can spam unicode and emoji all you want and it works.

If the characters don't show up, it's your browser or the font you're using.

NihilCredo
Jun 6, 2011

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

xzzy posted:

The forums "support" it just fine. You can spam unicode and emoji all you want and it works.

Not inside [ code ] blocks, they use a different font.

💩

code:
💩

xzzy
Mar 5, 2009

Well now that's just silly. They must be running it through one of php's escaping functions to preserve the formatting.

Another SA forums coding horror: smileys are case sensitive. :haw: vs :haw:

sarehu
Apr 20, 2007

(call/cc call/cc)
I'm disappointed that :h_a_w: doesn't work either.

Soricidus
Oct 21, 2010
freedom-hating statist shill
All the weird culturally-specific emoji are presumably Japan's revenge for han unification.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"
I appreciate that it seems like anything goes now when it comes to emojis in Unicode. Thank you iOS 9.1 for bringing me support for http://graphemica.com/🖕

Edit: And phone-posting apparently broke this. It was supposed to be the middle finger emoji. :(

Flobbster fucked around with this message at 02:12 on Oct 22, 2015

pseudorandom name
May 6, 2007

xzzy posted:

Too bad the display fonts haven't caught up. :v:




$ echo -e "\xf0\x9f\x8d\x94"
🍔

CLOSED WORKSFORME

ChubbyThePhat
Dec 22, 2006

Who nico nico needs anyone else
Not a horror but came across this on a random reddit post:

"I like to live dangerously, [ $[ $RANDOM % 6] == 0 ] && rm -rf / || echo Click"

They were looking for something to put on a CS club shirt. I liked this. I laughed.

Adbot
ADBOT LOVES YOU

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
What font are you using?

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