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
MononcQc
May 29, 2007

except they still kind of poorly do it (namely error handling, which I'm still mad about because it still relies on the dev faithfully checking the error value in order to prevent careening into undefined states with your program)

Adbot
ADBOT LOVES YOU

Volte
Oct 4, 2004

woosh woosh
i'm a pretty big fan of Swift-style error handling, although I'd prefer if the thrown error type could be specified. it's semantically similar to returning (value, error) in Go (since it's a natural representation of the NSError output parameter used throughout Apple's APIs) but it forces you to check the error

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

I avoid these issues by writing flawless, perferct code every time. I don't know why you guys haven't thought of it.

redleader
Aug 18, 2005

Engage according to operational parameters

Peeny Cheez posted:

I avoid these issues by writing flawless, perferct code every time. I don't know why you guys haven't thought of it.

thanks for the tip, rob pike

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

redleader posted:

thanks for the tip, professor of my graphics class

comedyblissoption
Mar 15, 2006

https://blog.golang.org/errors-are-values

quote:

The key lesson, however, is that errors are values and the full power of the Go programming language is available for processing them.

Use the language to simplify your error handling.

But remember: Whatever you do, always check your errors!
thanks rob pike

throb pike

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.


Peeny Cheez posted:

I avoid these issues by writing flawless, perferct code every time. I don't know why you guys haven't thought of it.

I know this was posted in jest but this line of thought is just baffling to me, like sure okay let's pretend you actually write good code, let alone perfect code, there's -other poo poo your system is dealing with- that might cause errors you need to handle. ARGBHRWQHGEAHG

necrotic
Aug 2, 2005
I owe my brother big time for this!
no i wrote those systems too and they are also perfecr

Soricidus
Oct 21, 2010
freedom-hating statist shill

Beamed posted:

I know this was posted in jest but this line of thought is just baffling to me, like sure okay let's pretend you actually write good code, let alone perfect code, there's -other poo poo your system is dealing with- that might cause errors you need to handle. ARGBHRWQHGEAHG

maybe you wouldn't get all those io exceptions if you fixed your lovely code to only try to read data from drives that haven't failed :smuggo:

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.


hardware issue, won'tfix

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Beamed posted:

hardware issue, won'tfix

I mean what else do you want? Some kind of fault tolerant system :fuckoff:

Vomik
Jul 29, 2003

This post is dedicated to the brave Mujahideen fighters of Afghanistan
I’ve never met an error I couldn’t handle

JawnV6
Jul 4, 2004

So hot ...
some place like the daily wtf had an interview horror story where the candidate was insisting that finally() blocks might not run and the interviewers were confident that one would always run

"what if I go up to the machine and unplug it? how does your finally() block run then?"
interviewers blanched, ended the interview

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

JawnV6 posted:

some place like the daily wtf had an interview horror story where the candidate was insisting that finally() blocks might not run and the interviewers were confident that one would always run

"what if I go up to the machine and unplug it? how does your finally() block run then?"
interviewers blanched, ended the interview

it runs when you plug the machine back in, obviously.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
good candidate

redleader
Aug 18, 2005

Engage according to operational parameters

JawnV6 posted:

some place like the daily wtf had an interview horror story where the candidate was insisting that finally() blocks might not run and the interviewers were confident that one would always run

"what if I go up to the machine and unplug it? how does your finally() block run then?"
interviewers blanched, ended the interview

in fairness, for a lot of things this usually doesn't matter

Stringent
Dec 22, 2004


image text goes here

JawnV6 posted:

some place like the daily wtf had an interview horror story where the candidate was insisting that finally() blocks might not run and the interviewers were confident that one would always run

"what if I go up to the machine and unplug it? how does your finally() block run then?"
interviewers blanched, ended the interview

i think the important distinction here would be is there any case where the finally() block would not run, but the rest of the program would. the answer to that should be no, but who the hell knows anything

Plank Walker
Aug 11, 2005

Peeny Cheez posted:

I avoid these issues by writing flawless, perferct code every time. I don't know why you guys haven't thought of it.

here's a hint: the code that never runs, never fails

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Peeny Cheez posted:

I avoid these issues by writing flawless, perferct code every time. I don't know why you guys haven't thought of it.

our new department head unironically said that at his previous company they just got things right on the first try, and we should just do that too

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

fart simpson posted:

our new department head unironically said that at his previous company they just got things right on the first try, and we should just do that too

Only registered members can see post attachments!

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Stringent posted:

i think the important distinction here would be is there any case where the finally() block would not run, but the rest of the program would. the answer to that should be no, but who the hell knows anything

i assume that the point of the exercise was to tease out something like
code:
public class DoOrDoNot {
	public static void main(String[] args) {
		try {
			System.out.println("YOSPOS");
			throw new Exception("wuh oh, not in amberpos.");
		}
		catch(Exception e) {
			Object b = new Object() {
				public void finalize() {
					System.out.println("I'M STILL KICKING, ASSHOLES.");
				}
			};
			Runtime.runFinalizersOnExit(true);
			System.out.println("BITHC!");
			System.exit(0);
			System.out.println("BITHC."); // this doesn't run.
		}
		finally {
			System.out.println("BITHC?"); // this also doesn't run.
		}
	}
}
code:
YOSPOS
BITHC!
I'M STILL KICKING, ASSHOLES.

Stringent
Dec 22, 2004


image text goes here
Yeah, see, there's always a way.

Zlodo
Nov 25, 2006

fart simpson posted:

our new department head unironically said that at his previous company they just got things right on the first try, and we should just do that too
At a company I worked before the boss once told us unironically not to make bugs when we asked to have a QA team

cinci zoo sniper
Mar 15, 2013





nice pornstar name

cinci zoo sniper
Mar 15, 2013





hahahahha

JawnV6
Jul 4, 2004

So hot ...

Stringent posted:

i think the important distinction here would be is there any case where the finally() block would not run, but the rest of the program would. the answer to that should be no, but who the hell knows anything

https://thedailywtf.com/articles/My-Tales

idk there isn't much more info, but i had the impression they were running critical things in the finallys

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Internet Janitor posted:

i assume that the point of the exercise was to tease out something like
code:
public class DoOrDoNot {
	public static void main(String[] args) {
		try {
			System.out.println("YOSPOS");
			throw new Exception("wuh oh, not in amberpos.");
		}
		catch(Exception e) {
			Object b = new Object() {
				public void finalize() {
					System.out.println("I'M STILL KICKING, ASSHOLES.");
				}
			};
			Runtime.runFinalizersOnExit(true);
			System.out.println("BITHC!");
			System.exit(0);
			System.out.println("BITHC."); // this doesn't run.
		}
		finally {
			System.out.println("BITHC?"); // this also doesn't run.
		}
	}
}
code:
YOSPOS
BITHC!
I'M STILL KICKING, ASSHOLES.

laffo @ java, i had no idea about this

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
finally doesn't run, finalizer runs if you toggle them on... can we have a galaxy brain"finalest" that always runs?

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER

I'm currently responsible for porting a piece of java code into python. I know no java.

it sure has a lot of @'s about

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Boiled Water posted:

I'm currently responsible for porting a piece of java code into python. I know no java.

it sure has a lot of @'s about

don't worry, @ just means something magical is happening.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
@ means annotation

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
A lot of frameworks using annotations to inject magic code to cut down on boilerplate, good luck figuring it out!

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

DONT THREAD ON ME posted:

don't worry, @ just means something magical is happening.
RetentionLevel.FUNTIME

feedmegin
Jul 30, 2008

JawnV6 posted:

some place like the daily wtf had an interview horror story where the candidate was insisting that finally() blocks might not run and the interviewers were confident that one would always run

"what if I go up to the machine and unplug it? how does your finally() block run then?"
interviewers blanched, ended the interview

Someone's never heard of a UPS :smuggo:

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Peeny Cheez posted:

RetentionLevel.FUNTIME

wish your posts were annotated @transient

Soricidus
Oct 21, 2010
freedom-hating statist shill

jit bull transpile posted:

wish your posts were annotated @transient

transient isn’t an annotation, it’s a regular modifier like static or volatile

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

jit bull transpile posted:

wish your posts were annotated @transient

WELL I NEVER

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Boiled Water posted:

I'm currently responsible for porting a piece of java code into python. I know no java.

it sure has a lot of @'s about

Why would you port something INTO pythong

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

Suspicious Dish posted:

Why would you port something INTO pythong

it isn't too bad if you use mypy, but we only use it for devops stuff basically

Adbot
ADBOT LOVES YOU

FlapYoJacks
Feb 12, 2009

Suspicious Dish posted:

Why would you port something INTO pythong

Because Python3.6+ is cool and good.

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