JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED
-
@topspin said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
More like a retarded switch, afaict.
Computed
goto
s are like the scary version ofswitch
. If they actually just always goto one of a defined set of addresses then they're the tame version, whereas if they're basically uncontrolled then they're the version that's on crack and acid at once. (Also, Rust definitely can't support that; that's because LLVM can't, and that's a very good thing! They're not always a bug in all programming language, alas, but probably should be.)
-
GCC has/had the much more ... fun version of that:
void g(), h(); void f( int x ) { void* dest[] = { &&foo, &&bar }; goto *(dest[x%2]); foo: g(); return; bar: h(); return; }
-
@levicki said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
@dkf said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
@levicki I'm hoping for someone to demonstrate how they can write a mixture of Perl and Fortran in Rust…
Don't look at me, I am not one of those Perl clutchers and my Fortran is more than a bit Rust-y.
I "C" what you did there
-
@cvi said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
GCC has/had the much more ... fun version of that:
void g(), h(); void f( int x ) { void* dest[] = { &&foo, &&bar }; goto *(dest[x%2]); foo: g(); return; bar: h(); return; }
shudders
-
@cvi What is that abomination?
-
@Rhywden Nonstandard extension by GCC.
<>Unfortunately.</>
-
@Rhywden said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
@cvi What is that abomination?
That's a
E_CODE_REVIEW_FAILED
. And that return value causes their machine to burst into subatomic particles.
-
@cvi That abomination looks like it does pretty much the same as the Fortran version. Unless it can do long jumps, that would be even worse.
-
Oh boy, I'm upgrading a part of my toolchain so I get reproducible builds, and while doing that I found out that another part is going to upgrade to Py3 in like 2 years. What a bunch of suck.
-
@dcon said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
@_P_ I love C++'s steady repeating pattern!
Java's matches it. I'm pretty sure that the reason for the annual double hump for both is the same: computer science classes in secondary and tertiary education.
-
@Captain said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
I found out that another part is going to upgrade to Py3 in like 2 years.
Do you mean “by the end of this year”? If not, ABANDON THOSE IDIOTS because they'll be locked to a totally unsupported platform in less than 10 months…
-
@dkf I don't know, there's just an announcement on the download page, and a request for comments. I guesstimated the timeline based on them starting to talk about it publicly. But they do seem to have Py3 packages out already.
filed under: I don't want to be their Py3 beta tester, I just want reproducible builds
-
@topspin said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
@cvi That abomination looks like it does pretty much the same as the Fortran version. Unless it can do long jumps, that would be even worse.
No long jumps. AFAIK, the Fortran version requires a list of labels. The C-extension takes a
void*
ptr.That translates into more fun.
void f() { std::minstd_rand rng(std::random_device{}()); void* targets[] = { &&a, &&b, &&c, &&d }; std::shuffle( targets, targets+sizeof(targets)/sizeof(targets[0]), rng ); goto *targets[0]; a: printf( "A\n" ); return; b: printf( "B\n" ); return; c: printf( "C\n" ); return; d: printf( "D\n" ); return; }
And, of course, it's C/C++, so there's plenty of foot-gun opportunities.
void f( int x ) { static unsigned char const a[] = { 0x48, 0x83, 0xc4, 0x28, 0xc3 }; void const* targets[] = { &a, &&b, &&c, &&d }; goto *targets[x]; a: printf( "A\n" ); return; b: printf( "B\n" ); return; c: printf( "C\n" ); return; d: printf( "D\n" ); return; }
(Note: missing & in front of &a.)
-
@cvi said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
@topspin said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
@cvi That abomination looks like it does pretty much the same as the Fortran version. Unless it can do long jumps, that would be even worse.
AFAIK, the Fortran version requires a list of labels. The C-extension takes a
void*
ptr. That translates into more fun.If you draw a random index instead of shuffling the targets, you can achieve the same thing. (Only that it’s Fortran, so obviously you’ll have to write the PRNG yourself.)
And, of course, it's C/C++, so there's plenty of foot-gun opportunities.
That’s a given.
But hey, at least a post-K&R C compiler won’t let you call a function with the wrong number of arguments, so that’s a foot-gun point for Fortran.
-
@topspin said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
If you draw a random index instead of shuffling the targets, you can achieve the same thing.
I tried to find a simple example that messes with the addresses to the labels (but doesn't do anything UB with them). That was the simplest I could come up with. In fortran, you can't because (AFAIK) they have to be literals.
-
@topspin said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
And, of course, it's C/C++, so there's plenty of foot-gun opportunities.
That’s a given.
But hey, at least a post-K&R C compiler won’t let you call a function with the wrong number of arguments, so that’s a foot-gun point for Fortran.
-
@topspin said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
But hey, at least a post-K&R C compiler won’t let you call a function with the wrong number of arguments, so that’s a foot-gun point for Fortran.
Unless you're dealing with variadic functions of course. Do any compilers yet have support for argument checking on format strings which aren't the same as those from printf, scanf, or strftime?
-
@PleegWat Sounds impossible, so I’m going with “unlikely”.
-
@PleegWat said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
Do any compilers yet have support for argument checking on format strings which aren't the same as those from printf, scanf, or strftime?
There's also some basic argument checking of NULL-terminated lists of arguments (the other common case) but in general, no. I've looked up how clang does it (as that tends to be the most readable public compiler source code) and that's only extensible by hacking the C++ source code to clang itself (about two thirds of the way through SemaChecking.cpp). It's not in any way an easy plug extensibility point!
BTW, that's a 14kloc file. Ugh!
-
-
@TimeBandit I love how he stole the joke from Reddit post, and also added a reply in which he stole another joke from that Reddit post's top comment.
-
@Gąska To be fair, reddit is like StackOverflow for jokes
-
@hungrier said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
@Gąska To be fair, reddit is like StackOverflow for jokes
IOW, your joke gets closed, marked duplicate after 2 minutes
-
@dkf said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
@topspin said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
More like a retarded switch, afaict.
Computed
goto
s are like the scary version ofswitch
. If they actually just always goto one of a defined set of addresses then they're the tame version, whereas if they're basically uncontrolled then they're the version that's on crack and acid at once. (Also, Rust definitely can't support that; that's because LLVM can't, and that's a very good thing! They're not always a bug in all programming language, alas, but probably should be.)Talking about ugly switches and gotos, I just saw code using Duff's device (wikipedia) on libb64. Github link, the onebox wasn't very useful
-
@Gąska said in JAVASCRIPT OUTDATED JAVA OVERRATED LONG HAVE WE WAITED PYTHON ACTIVATED:
@TimeBandit I love how he stole the joke from Reddit post, and also added a reply in which he stole another joke from that Reddit post's top comment.
-
@pie_flavor It's true. We TFWTFians can steal from Twitter comments too.