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
Ola
Jul 19, 2004

Scaramouche posted:

code:
If (AtFirstArray[0]) != 'Succeed')
   { Try
       { Try 
          { // Again
          }
       }
    }

code:
finally {
   fail();
}

Adbot
ADBOT LOVES YOU

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Scaramouche posted:

code:
If (At.first() != 'Succeed')


:colbert:

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Ola posted:

code:
finally {
   fail();
}

code:
before {
  giveUp();
}

Absurd Alhazred
Mar 27, 2010

by Athanatos
C++ code:
if (giveYouUp.wait())
{
	throw std::exception("NEVER");
}

FlapYoJacks
Feb 12, 2009

Absurd Alhazred posted:

C++ code:
if (giveYouUp.wait())
{
	throw std::exception("NEVER");
}

code:
#define NEVER 0
while(tryNotGiveUp() || true){
    sleep(NEVER);
}
:colbert:

Magissima
Apr 15, 2013

I'd like to introduce you to some of the most special of our rocks and minerals.
Soiled Meat

Ola posted:

code:
finally {
   fail();
}
No matter how many times you try or what you catch, failure is inevitable

Happy Thread
Jul 10, 2005

by Fluffdaddy
Plaster Town Cop
Lotta coding horrors on this page

Volguus
Mar 3, 2009
ObjectiveC.

I recently had to read and fix an iOS ObjectiveC project. I have decades of experience, many languages and platforms. Yet, nothing has ever prepared me for ObjectiveC. WTF is wrong with that syntax? Do people get used to it? Assigning a value to an object member seems like insanity. Can't wait to try Swift, hopefully they made a reasonable enough language that mere mortals can read and write.

gently caress, ObjectiveC is an horror in and of itself.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Volguus posted:

ObjectiveC.

I recently had to read and fix an iOS ObjectiveC project. I have decades of experience, many languages and platforms. Yet, nothing has ever prepared me for ObjectiveC. WTF is wrong with that syntax? Do people get used to it? Assigning a value to an object member seems like insanity. Can't wait to try Swift, hopefully they made a reasonable enough language that mere mortals can read and write.

gently caress, ObjectiveC is an horror in and of itself.

Yeah you get used to it. It's been a long time since I've messed with it but the bracket syntax is there to emphasize the idea that you're sending a message to a receiver.

Swift syntax is just nice modern algol. No complaints. Could be more expression-y I guess but that's just my taste. Feels good on my eyes and my fingers.

DONT THREAD ON ME fucked around with this message at 05:03 on Feb 16, 2019

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
most modern languages seem to be converging on the one true syntax

Soricidus
Oct 21, 2010
freedom-hating statist shill

DONT THREAD ON ME posted:

most modern languages seem to be converging on the one true syntax

really? there's clojure I guess, which other examples are you thinking of?

spiritual bypass
Feb 19, 2008

Grimey Drawer
ML

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

Volguus posted:

ObjectiveC.

I recently had to read and fix an iOS ObjectiveC project. I have decades of experience, many languages and platforms. Yet, nothing has ever prepared me for ObjectiveC. WTF is wrong with that syntax? Do people get used to it? Assigning a value to an object member seems like insanity. Can't wait to try Swift, hopefully they made a reasonable enough language that mere mortals can read and write.

gently caress, ObjectiveC is an horror in and of itself.

It's really good in my opinion. Maybe a little verbose, but passing arguments in the middle of the name of a method, instead of after it, was a brilliant idea. Autorelease pools and ARC are things I would have killed for when I wrote COM code, and blocks really rounded out the language nicely. It has a really good object model, although maybe not very efficient. I really liked Objective C when I worked with it

Swift, though, is so much better

Literally Elvis
Oct 21, 2013

omeg posted:

Exceptions were a mistake.

Unironically this

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Soricidus posted:

really? there's clojure I guess, which other examples are you thinking of?

i was being facetious but look at like, swift, kotlin, rust, they're all basically algol but with some ML. the more ML the better imo.

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

Volguus posted:

ObjectiveC.

I recently had to read and fix an iOS ObjectiveC project. I have decades of experience, many languages and platforms. Yet, nothing has ever prepared me for ObjectiveC. WTF is wrong with that syntax? Do people get used to it? Assigning a value to an object member seems like insanity. Can't wait to try Swift, hopefully they made a reasonable enough language that mere mortals can read and write.

gently caress, ObjectiveC is an horror in and of itself.

It's literally just Smalltalk embedded into C, and quite cleverly done. But remember that you can be too clever for your own good...

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)

I want an MLish shell to replace bash/coreutils.

E: F# interpreter doesn't count.

Some moons ago, there was a guy I worked with that annoyed me a lot. I would always change his shell to oddball poo poo when I had the chance. F# seemed to frustrate him the most.

dougdrums fucked around with this message at 19:06 on Feb 16, 2019

Rubellavator
Aug 16, 2007

This isn't even a horror or all that bad. A new dev picked up a fairly simple ticket that involved adding two fields to an import and some logic in the backend. He talked about doing boolean algebra and even had an excel spreadsheet where he was doing truth tables.

All for what basically could be written as:
code:
if (option1)
{
	if (option2 == "A" && isNumber(value))
		optionField = "A";
	else if (option2 == "B")
		optionField = "B";
}
Except this is how he wrote it:
code:
if (option1 && (option2 == "B" || isNumber(value))) 
{
	if (option2 == "A")
		optionField = "A"
	else
		optionField = "B";
}

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.

Rubellavator posted:

This isn't even a horror or all that bad. A new dev picked up a fairly simple ticket that involved adding two fields to an import and some logic in the backend. He talked about doing boolean algebra and even had an excel spreadsheet where he was doing truth tables.

All for what basically could be written as:
code:
if (option1)
{
	option2 == "A" && isNumber(value))
		optionField = "A";
	else if (option2 == "B")
		optionField = "B";
}
Except this is how he wrote it:
code:
if (option1 && (option2 == "B" || isNumber(value))) 
{
	if (option2 == "A")
		optionField = "A"
	else
		optionField = "B";
}
Your examples are both gross.
code:
optionField = option1 && option2 == "A" && isNumber(value) ? "A" : "B";

Rubellavator
Aug 16, 2007

Bruegels Fuckbooks posted:

Your examples are both gross.
code:
optionField = option1 && option2 == "A" && isNumber(value) : "A" : "B";

Cool you set optionField to "B" when option1 wasn't selected. Failed.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
in order for that to not suck your language needs if or match expressions. the ternary example is the right idea but needs a better language construct.

DONT THREAD ON ME fucked around with this message at 19:22 on Feb 16, 2019

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


dougdrums posted:

I want an MLish shell to replace bash/coreutils.

E: F# interpreter doesn't count.

Some moons ago, there was a guy I worked with that annoyed me a lot. I would always change his shell to oddball poo poo when I had the chance. F# seemed to frustrate him the most.

"turtle is a reimplementation of the Unix command line environment in Haskell so that you can use Haskell as both a shell and a scripting language."

iospace
Jan 19, 2038



Just because you can doesn't mean you should.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Bruegels Fuckbooks posted:

Your examples are both gross.
code:
optionField = option1 && option2 == "A" && isNumber(value) ? "A" : "B";

The code you've posted here is not equivalent to either of the two pieces of code Rubellavator posted.

NihilCredo
Jun 6, 2011

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

code:
optionField = 
  !option1 ? optionField
           : (option2 == "A" && isNumber(value)) ? "A"
                                                 : "B"
  ;

fritz
Jul 26, 2003


All files are a-rwx.

Ola
Jul 19, 2004

Rubellavator posted:

This isn't even a horror or all that bad. A new dev picked up a fairly simple ticket that involved adding two fields to an import and some logic in the backend. He talked about doing boolean algebra and even had an excel spreadsheet where he was doing truth tables.

All for what basically could be written as:
code:
if (option1)
{
	if (option2 == "A" && isNumber(value))
		optionField = "A";
	else if (option2 == "B")
		optionField = "B";
}

But what if option2 == "A" but isNumber(value) == false? optionField correctly remains whatever it was before if (option1)?

e: I should say I love cutting through complicated nesting with boolean algebra, but often it just turns a readable but inelegant 7-liner into a difficult to read, CS-professor nerdboner 6-liner.

Rubellavator
Aug 16, 2007

Ola posted:

But what if option2 == "A" but isNumber(value) == false? optionField correctly remains whatever it was before if (option1)?

e: I should say I love cutting through complicated nesting with boolean algebra, but often it just turns a readable but inelegant 7-liner into a difficult to read, CS-professor nerdboner 6-liner.

It should stay null. optionField is something that was added in a later revision of the standard we use. We're offering them the ability to set that field during import if they're using a revision that predates it.

Basically, 40 years ago some guy needed a new 3 character field to an 80 character width card, but he didn't have room, so he repurposed a related field and added a 1 character flag field so that you could know how the repurposed field was being used.

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.

Hammerite posted:

The code you've posted here is not equivalent to either of the two pieces of code Rubellavator posted.

Actually the right answer is to throw all that lovely code out and start again if it's not equivalent. If you have to draw truth tables to figure out how to check a field in a select box your design is hosed.

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

Soricidus posted:

really? there's clojure I guess, which other examples are you thinking of?
I'm willing to admit that lisps are slightly better than catching your weenis in a zipper, but clojure is just loving dogshit.

redleader
Aug 18, 2005

Engage according to operational parameters

Rubellavator posted:

Basically, 40 years ago some guy needed a new 3 character field to an 80 character width card, but he didn't have room, so he repurposed a related field and added a 1 character flag field so that you could know how the repurposed field was being used.

There's always a greater horror.

Beamed
Nov 26, 2010

Then you have a responsibility that no man has ever faced. You have your fear which could become reality, and you have Godzilla, which is reality.


Fatty Crabcakes posted:

I'm willing to admit that lisps are slightly better than catching your weenis in a zipper, but clojure is just loving dogshit.

What? Clojure is what convinced me to give in to the Lisps, who only ever loved me and wanted me to love them.

Qwertycoatl
Dec 31, 2008

https://twitter.com/chrisbranch/status/1094581030147768320

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Bruegels Fuckbooks posted:

Actually the right answer is to throw all that lovely code out and start again if it's not equivalent. If you have to draw truth tables to figure out how to check a field in a select box your design is hosed.

You don't have to draw truth tables, though. Rubellavator's co-worker was making a mountain out of a molehill, this individual piece of logic is not that complicated. Additionally, it sounds from Rubellavator's posts providing additional context as though this is a small part of a complex existing system that can't necessarily be simplified as you would like.

The real answer is unit tests.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.
code:
try {
  Guard.ArgumentNotNull(foo, “foo”);
  foo.bar();
}
catch {
  Log.Error(“foo null”);
}
Why yes, I would like to add the overhead of a try block to my already hilariously expensive null check that crosses the native boundary (thanks unity). Assuming it even uses == internally.

Funny part is that I think it found its way into the code because someone googled “null check unity” and got to MSDN for Microsoft’s DI container.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

leper khan posted:

code:
try {
  Guard.ArgumentNotNull(foo, “foo”);
  foo.bar();
}
catch {
  Log.Error(“foo null”);
}
Why yes, I would like to add the overhead of a try block to my already hilariously expensive null check that crosses the native boundary (thanks unity). Assuming it even uses == internally.

Funny part is that I think it found its way into the code because someone googled “null check unity” and got to MSDN for Microsoft’s DI container.

I think this mindless bit of copypasta rises to the glorious level of "indistinguishable from intentional obfuscation". Incredible.

Hughlander
May 11, 2005

pokeyman posted:

I think this mindless bit of copypasta rises to the glorious level of "indistinguishable from intentional obfuscation". Incredible.

Well I assume it’s for Unity3D which does questionable things with overriding.Equals for null checks that causes Elvis operator to work in the editor but fail on a device. They asked for a way to override ?. And were told to go gently caress themselves.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
I spent a day doing unity without a whole lot of game dev or c# experience and it was very clear to me that there are untold horrors hiding there.

ToxicFrog
Apr 26, 2008


Beamed posted:

What? Clojure is what convinced me to give in to the Lisps, who only ever loved me and wanted me to love them.

While I love Clojure and had the same experience with it, it is never far from my mind that its error reporting sucks endless fields of rotting rear end, and that's the main thing that prevents me from wholeheartedly recommending it to everyone.

A runtime error is just a plain old Java exception, so you get a gross mix of Clojure stack frames, Java stack frames in Java libraries you called deliberately, and Java stack frames in the internals of Clojure itself filling multiple pages of terminal. Coming from languages like Lua or Python (or even plain Java) where errors don't generally lay the guts of the interpreter out all over your terminal, this is pretty shocking.

Compile-time errors are even worse, because they also use the Java exception mechanism, so you forget a ) somewhere and now you have an 80-line stack trace with the actual error buried somewhere at the top of it. If you're really unlucky, it can't even figure out what file the error is in; I think this has only happened to me once, but it should never happen.

And if you're using something like core.typed it's great when it works, but when it goes wrong it goes vastly, incomprehensibly wrong.

There are libraries that improve on this somewhat, like Pretty, but they're still generally not as good as what you get out of the box in other managed languages.

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
I will say this: if you need a dynamic language on the JVM, you could do a hell of a lot worse than Clojure.


Groovy

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