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
Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

rotor posted:

if there was a "bring keyboard to mains voltage" instruction, I would use it every time someone used the "right-click, copy" menu item.

same but with the securecrt "copy and paste" function

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006
even if lazy developers just catch(Exception e) {} its still better for good developers because it makes it very clear when they should handle those exceptions rather than having to inspect the documentation.

checked exceptions are ftw

Shaggar
Apr 26, 2006
although you could do it horribly wrong and use exceptions as flow control like in python

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

even if lazy developers just catch(Exception e) {} its still better for good developers because it makes it very clear when they should handle those exceptions rather than having to inspect the documentation.

checked exceptions are ftw

You could return an object, that made it clear you had to handle things.

foo = obj.blah()

if (foo.valid()) { .... } else {....}

it makes it clear too.

tef
May 30, 2004

-> some l-system crap ->
so clear, in fact, you can see obviously where it is returned, and where it is handled.

tef
May 30, 2004

-> some l-system crap ->
and you could return it from a function, or even pass it into another function for handling.


checked exceptions on the other hand don't really get you any of that.

Zombywuf
Mar 29, 2008

tef posted:

the idea that all exceptions must be errors is a weird one, especially when, at heart they are often more about non-local exits, rather than handling errors. you still have to write all the error handling code.

error handling and fault tolerance comes from isolation of components, and exceptions don't do anything to help with that. i don't understand the 'oh poo poo you're using a non-local exit for something other than a failure, how dare you' mentality.

The idea that procedures should receive invocation specific data by function arguments is a weird one, especially when, at heart it is about passing data about rather than any mathematical abstraction. You still have to actually use the data.

Error handling and fault tolerance comes from isolation of components, and function arguments don't do anything to help with that. I don't understand the 'oh poo poo you're using global variables for something other than global state, how dare you' mentality.


tl;dr; you use exceptions to tell the human reading the code that this is an error.

Also, explicitly handling errors in the return value of every function is slow and ugly.

JG_Plissken
Oct 22, 2005

I went to a four year college and all I got was this stupid look on my face!
slugly

JawnV6
Jul 4, 2004

So hot ...

rotor posted:

you can tell I'm a hardcore coder by the lovely, archaic tools I use.

shhhh.....

JawnV6
Jul 4, 2004

So hot ...

Zombywuf posted:

The idea that procedures should receive invocation specific data by function arguments is a weird one, especially when, at heart it is about passing data about rather than any mathematical abstraction. You still have to actually use the data.

ur not clever enough to pull this off

Zombywuf
Mar 29, 2008

JawnV6 posted:

ur not clever enough to pull this off

It might be more of an in joke.

Also, everyone read this book http://www.dreamsongs.com/Files/PatternsOfSoftware.pdf

Police Academy III
Nov 4, 2011
speaking of checked exceptions, I ran across this today:

code:
/**
 * Throw even checked exceptions without being required
 * to declare them or catch them. Suggested idiom:
 * <p>
 * <code>throw sneakyThrow( some exception );</code>
 */
static public RuntimeException sneakyThrow(Throwable t) {
    // [url]http://www.mail-archive.com/javaposse@googlegroups.com/msg05984.html[/url]
	if (t == null)
		throw new NullPointerException();
	Util.<RuntimeException>sneakyThrow0(t);
	return null;
}

@SuppressWarnings("unchecked")
static private <T extends Throwable> void sneakyThrow0(Throwable t) throws T {
	throw (T) t;
}

Rufus Ping
Dec 27, 2006





I'm a Friend of Rodney Nano

JawnV6 posted:

ur not clever enough to pull this off

thanks jawn

tef
May 30, 2004

-> some l-system crap ->

Zombywuf posted:

It might be more of an in joke.

Yep :unsmith:

Shaggar
Apr 26, 2006

tef posted:

You could return an object, that made it clear you had to handle things.

foo = obj.blah()

if (foo.valid()) { .... } else {....}

it makes it clear too.

not if you're calling a method that already returns an object. unless you're gonna make all objects potentially contain exceptions which would be dumb.

exceptions are the right way to do it and checked exceptions are the right way to do it for problems that should be handled in code.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Shaggar do you think the code should handle database exceptions or just let them bubble up the call stack instead?

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

tef posted:

the idea that all exceptions must be errors is a weird one, especially when, at heart they are often more about non-local exits, rather than handling errors. you still have to write all the error handling code.

error handling and fault tolerance comes from isolation of components, and exceptions don't do anything to help with that. i don't understand the 'oh poo poo you're using a non-local exit for something other than a failure, how dare you' mentality.

(exceptions are also used to solve the semi predicate problem (instead of option types), and in some languages exceptions are more like co-routines (restartable exceptions) rather than delimined continuations :catdrugs:)

it could be because the name "exception" implies "exceptional circumstances"

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
i guess it all boils down to arguing over the definition of "is"

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
tahnk god i work in objective-c which doesn't have exceptions uh huh huh huh fuh fuh fuh

Rufus Ping
Dec 27, 2006





I'm a Friend of Rodney Nano

lol

syntaxrigger
Jul 7, 2011

Actually you owe me 6! But who's countin?

Ronald Raiden posted:

I swear I was planning to contribute to hyperglyph this weekend but dark souls and then spilling beer on my macbook happened.

goon project on unity?

Opinion Haver
Apr 9, 2007

Tiny Bug Child posted:

static languages: when you want to waste a whole lot of time telling the computer things it already knows

maybe if you use a bad language that can't determine types for you

double sulk
Jul 2, 2010

Sneaking Mission
Nov 11, 2008

sulk, the good posts:

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Shaggar
Apr 26, 2006

Hard NOP Life posted:

Shaggar do you think the code should handle database exceptions or just let them bubble up the call stack instead?

I generally wrap db exceptions in model exceptions and throw them up the chain. The db connection module probably cant do much to fix the problem, so it should throw it up through the model interfaces to let whatever's consuming them handle it (most likely to notify someone of the db problem). The abstraction lets you change the underlying db system w/out freaking out the consumers.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

yaoi prophet posted:

maybe if you use a bad language that can't determine types for you

right. the good languages (like php) don't complain when you want to add two numbers because one of them is a string or some other fake computer idea, they just do it

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Tiny Bug Child posted:

right. the good languages (like php) don't complain when you want to add two numbers because one of them is a string or some other fake computer idea, they just do it

stfu boring trash

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
i dont really think type safety is worth the effort.

ok, yeah, I will occasionally write code where i pass the string "true" instead of the boolean true or whatever, but the bugs these cause are typically obvious and easy to find.

the flexibility you give up by moving from an un- or weakly-typed language to a strongly typed one is imho a trade not worth making, as a general rule.

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

rotor posted:

i dont really think type safety is worth the effort.

ok, yeah, I will occasionally write code where i pass the string "true" instead of the boolean true or whatever, but the bugs these cause are typically obvious and easy to find.

the flexibility you give up by moving from an un- or weakly-typed language to a strongly typed one is imho a trade not worth making, as a general rule.

yea and debuggers are too hard and ide's are too complicated

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
BUT BUT BUT what happens if you try to add 5 and "five" :smug:

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

vapid cutlery posted:

yea and debuggers are too hard and ide's are too complicated

why debug a program when it can just run right the first time cause it does the obviously correct thing w/r/t type juggling.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

vapid cutlery posted:

yea and debuggers are too hard and ide's are too complicated

yeah but those have benefits

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Tiny Bug Child posted:

why debug a program when it can just run right the first time cause it does the obviously correct thing w/r/t type juggling.

do u ever get tired of your boring 1=0 nonsense

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

vapid cutlery posted:

do u ever get tired of your boring 1=0 nonsense

no because it's so incredibly handy and it works the way i want it to 99% of the time yet people never stop trying to hold up php's type juggling system like it's a bad thing

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Tiny Bug Child posted:

no because it's so incredibly handy and it works the way i want it to 99% of the time yet people never stop trying to hold up php's type juggling system like it's a bad thing

i'm talking about your dumb gimmick where you say the wrong thing repeatedly as if it's funny or interesting. loving lmao if 1=0 is a normal php thing. jesus christ

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

vapid cutlery posted:

i'm talking about your dumb gimmick where you say the wrong thing repeatedly as if it's funny or interesting. loving lmao if 1=0 is a normal php thing. jesus christ

i don't do that maybe you're confusing me with a guy that calls you a good poster

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Tiny Bug Child posted:

i don't do that maybe you're confusing me with a guy that calls you a good poster

you're weak as poo poo

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

vapid cutlery posted:

you're weak as poo poo

mlyp

Adbot
ADBOT LOVES YOU

Opinion Haver
Apr 9, 2007

rotor posted:

i dont really think type safety is worth the effort.

ok, yeah, I will occasionally write code where i pass the string "true" instead of the boolean true or whatever, but the bugs these cause are typically obvious and easy to find.

the flexibility you give up by moving from an un- or weakly-typed language to a strongly typed one is imho a trade not worth making, as a general rule.

probably my biggest frustration with strongly typed haskell is 'okay i want to know what the hell type this is evaluating to so i can fix it', it's easy to do that if the function i'm defining isn't used anywhere else but if it is i have to rename it to foo', let foo = undefined, and check the type of foo'

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