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
Shaggar
Apr 26, 2006
I've been doing almost exclusively c# for the last few months and I like it a bunch. I just wish there were checked exceptions and a maven like.

gonna be rewriting our existing call center app soon in wpf and its gonna own so much.

make me ceo of Microsoft and i'll fix it ez.

Adbot
ADBOT LOVES YOU

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

Base Emitter posted:

C is great and C++ ok as domain specific languages for loving with hardware and graphics and writing runtimes for other languages and doing other related things.

Trying to turn C++ into a general purpose language - especially through terrible template libraries - is a giant waste of time in a world that has C#.

Operator overloading is sketchy as gently caress however and overloading >> to mean io in C++ was the first sign that God had cursed it.

but dude, what if its shifting it into the stream

GameCube
Nov 21, 2006

FamDav posted:

jmp as gently caress

yeah that was my assumption, whoops

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Werthog 95 posted:

i'm only just now learning how to do c++ the right way but "gogo cleanup-code;" does not sound very exception-safe
it is if you're writing functions that catch all internal exceptions and translate them to platform error codes

FamDav posted:

im not sure how you're using it as an alternative since variables that are to be destructed at the end of a block will do so even if you use goto.
the cleanup code is specifically for the sake of variables that do not have destructors, or for which the wrapper class's semantics are not quite what you need

Gazpacho fucked around with this message at 03:15 on Mar 1, 2013

Base Emitter
Apr 1, 2012

?

Shaggar posted:

I've been doing almost exclusively c# for the last few months and I like it a bunch. I just wish there were checked exceptions and a maven like.

gonna be rewriting our existing call center app soon in wpf and its gonna own so much.

make me ceo of Microsoft and i'll fix it ez.

checked exceptions are bad. they make sense if you only look at little toy projects but in any real world application they get to be unmanageable. enjoy your unchecked c# exceptions because c# is already right.

GameCube
Nov 21, 2006

Notorious b.s.d. posted:

i'm not sure we can even call all of these "perks:" https://www.expensify.com/jobs/offshore

every year they make the entire team spend a month overseas
you know what you don't see in any of the overseas photos? wives and children

this is basically one big loving discrimination scam, the ultimate "culture fit" -- if you have any strong ties in society, you won't "fit." what kind of maladjusted freak can afford to just drop out of society for a month because his boss wants to chill in thailand? (only 20-something silly-con valley fuckwits need apply)

somebody post that "startup culture fit" blog again because that was great

Bream
Feb 3, 2013

Farmer's Barket

Shaggar posted:

also operator overloading is the worst thing

Let's say I have two 3D vectors. Which looks better?

v1 * v2

v1.multiply_by(v2)

vec3fmult(v1, v2)

FamDav
Mar 29, 2008

Gazpacho posted:

the cleanup code is specifically for the sake of variables that do not have destructors, or for which the wrapper class's semantics are not quite what you need

even so, variables with automatic storage will still be destructed once they go out of scope. youre not avoiding raii if you have bare pointers or classes whose destructors cant independently destruct the class, you're just not taking advantage of it

i imagine youre talking about dealing with junk like handles from windows apis but seriously man wrap that poo poo up.

EDIT: i have no with problem goto i just think calling it an alternative to raii is silly. also goto's force you into declaring/initializing things upfront which is weird

FamDav fucked around with this message at 03:32 on Mar 1, 2013

Base Emitter
Apr 1, 2012

?

Bream posted:

Let's say I have two 3D vectors. Which looks better?

v1 * v2

v1.multiply_by(v2)

vec3fmult(v1, v2)

Well, did you mean

v1.multiply_components(v2);
v1.inner_product(v2);
v1.cross_product(v2);

and this is why operator overloading is loving terrible. Unless an operator means the same thing every time, you can't read your goddamned code any more, and v1*v2 doesn't clearly and definitely mean a specific one of these, and every way the semantics of an operation differ from "real" * is an opportunity to gently caress something up. Also, every other project will choose differently than you did, so reading multiple code bases gets even worse.

skeevy achievements
Feb 25, 2008

by merry exmarx

Base Emitter posted:

Operator overloading is sketchy as gently caress however and overloading >> to mean io in C++ was the first sign that God had cursed it.

operator overloading is loving fantastic if you're doing a lot of math with your C language

Star War Sex Parrot
Oct 2, 2003

and operator overloading gets argued about for the 400th time in this 427-page thread

rotor
Jun 11, 2001

classic case of pineapple on pizzadog derangement syndrome
using operator overloading is fine unless you're writing libraries in which case DON'T!!!

skeevy achievements
Feb 25, 2008

by merry exmarx

Base Emitter posted:

Operator overloading is sketchy as gently caress however and overloading >> to mean io in C++ was the first sign that God had cursed it.

operator overloading is loving fantastic if you're doing a lot of math with your C language

Base Emitter posted:

Well, did you mean

v1.multiply_components(v2);
v1.inner_product(v2);
v1.cross_product(v2);

and this is why operator overloading is loving terrible. Unless an operator means the same thing every time, you can't read your goddamned code any more, and v1*v2 doesn't clearly and definitely mean a specific one of these, and every way the semantics of an operation differ from "real" * is an opportunity to gently caress something up. Also, every other project will choose differently than you did, so reading multiple code bases gets even worse.

this is no different than old fashioned paper math where X * Y means very different things for scalars and tensors

PENETRATION TESTS
Dec 26, 2011

built upon dope and vice
operator overloading owns, dwi

if you can't quickly get your head around what symbol means what operation then you probably couldn't handle math classes in the first place

sure, it should be used sparingly outside of math... whatever man

Shaggar
Apr 26, 2006

Base Emitter posted:

checked exceptions are bad. they make sense if you only look at little toy projects but in any real world application they get to be unmanageable. enjoy your unchecked c# exceptions because c# is already right.

this is super wrong and a sign your design is bad

PENETRATION TESTS
Dec 26, 2011

built upon dope and vice
see e.g. the page in every math book ever that shows the author's own arbitrary scheme of symbols and fonts

Shaggar
Apr 26, 2006
operator overloading is another form of code obfuscation that will be abused more often than its useful. sure it makes sense for math, but theres no way to restrict it to math.

Star War Sex Parrot
Oct 2, 2003

more ternary operators all the time

use them a lot

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
overload the ternary operator as rand(a) % b

yospos ? 420 : 69

rotor
Jun 11, 2001

classic case of pineapple on pizzadog derangement syndrome
everyone goes all pear shaped the minute they have to type a few words. I dont know why code terseness has been elevated to a position so out of proportion with its utility but it bugs me.

I suspect its because people see these tiny, terse little examples in books and assume the terseness is there for a good technical reason instead of just because it had to fit on a page.

Bream
Feb 3, 2013

Farmer's Barket

Base Emitter posted:

Well, did you mean

v1.multiply_components(v2);
v1.inner_product(v2);
v1.cross_product(v2);

and this is why operator overloading is loving terrible. Unless an operator means the same thing every time, you can't read your goddamned code any more, and v1*v2 doesn't clearly and definitely mean a specific one of these, and every way the semantics of an operation differ from "real" * is an opportunity to gently caress something up. Also, every other project will choose differently than you did, so reading multiple code bases gets even worse.

But there's no such thing as a "real" * for non builtin types, so if you're already defining a type, then you probably know what you mean, right? I take your point that if someone were to hand you something out of context, this question would be appropriate, but once you've seen the definition and say "Oh, okay, they mean componentwise multiplication" then (especially) v1 *= v2 becomes a lot more readable than v1 = v1.multiply_components(v2).

FamDav
Mar 29, 2008
rotor do you need bigger type because of your old eyes

Bream
Feb 3, 2013

Farmer's Barket

Shaggar posted:

operator overloading is another form of code obfuscation that will be abused more often than its useful. sure it makes sense for math, but theres no way to restrict it to math.

Only your good sense, man-o.

I want to hear stories of non-const overloads of ~ and & with bonus side effects!

rotor
Jun 11, 2001

classic case of pineapple on pizzadog derangement syndrome
I'm young

FamDav
Mar 29, 2008

Bream posted:

Only your good sense, man-o.

I want to hear stories of non-const overloads of ~ and & with bonus side effects!

overloading the reference operator could be useful if you want to implement some crazy memory management scheme under the hood.

notice i said crazy

Sapozhnik
Jan 2, 2005

Nap Ghost
teaching things from first principles isn't a controversial idea in any other field of engineering, and there isn't much to get about asm. it's not practical but neither is differentiating x^2 from first principles.

skeevy achievements
Feb 25, 2008

by merry exmarx

Shaggar posted:

operator overloading is another form of code obfuscation that will be abused more often than its useful. sure it makes sense for math, but theres no way to restrict it to math.

every language feature can and has been abused badly, that's not a valid reason to strip it out

see: junior developer death by reflection, or N-level inheritance/interface abstraction hierarchies

double sulk
Jul 2, 2010

@tef: yesss matz just explained a feature of parse.y to me - it did take a few minutes of grepping http://t.co/fRFJeYvoVs

Shaggar
Apr 26, 2006
reflection is more work than doing it the right way, though, so you have to actively want to do the wrong thing. operator overloading is a shortcut for lazy shits who want to save a few keystrokes at the expense of readability.

more like dICK
Feb 15, 2010

This is inevitable.

gucci void main posted:

@tef: yesss matz just explained a feature of parse.y to me - it did take a few minutes of grepping http://t.co/fRFJeYvoVs

This thread got so bad that tef stopped posting, and now sulk is just quoting his twitter account.

rotor
Jun 11, 2001

classic case of pineapple on pizzadog derangement syndrome
tef isn't on the internet much lately

Shaggar
Apr 26, 2006

Bream posted:

But there's no such thing as a "real" * for non builtin types, so if you're already defining a type, then you probably know what you mean, right? I take your point that if someone were to hand you something out of context, this question would be appropriate, but once you've seen the definition and say "Oh, okay, they mean componentwise multiplication" then (especially) v1 *= v2 becomes a lot more readable than v1 = v1.multiply_components(v2).

you probably know what you mean, but other people who want to use your code wont. (no one wants to use ur code tho so its cool)

Bream
Feb 3, 2013

Farmer's Barket

Shaggar posted:

you probably know what you mean, but other people who want to use your code wont. (no one wants to use ur code tho so its cool)

No one wants to read your posts, and yet . . .

more like dICK
Feb 15, 2010

This is inevitable.

rotor posted:

tef isn't on the internet much lately

Maybe I can summon him by posting about the embeddable Prolog interpreter that I made

PROLOG

PROLOG

PROLOG

skeevy achievements
Feb 25, 2008

by merry exmarx

Shaggar posted:

reflection is more work than doing it the right way, though, so you have to actively want to do the wrong thing. operator overloading is a shortcut for lazy shits who want to save a few keystrokes at the expense of readability.

C# supports reflection and yet somehow you find the courage not to use it

operator overloading works the same way

Shaggar
Apr 26, 2006
java supports reflection too. in both cases its work to use. operator overloading is just another method.

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
i dont totally get why the overloading thing is such a thing

is it really that useful? i mean i get the ideas of simple indicators of complex things like vector multiplies, and why it'd be easy to work with, but how often is it really used

skeevy achievements
Feb 25, 2008

by merry exmarx

Shaggar posted:

java supports reflection too. in both cases its work to use. operator overloading is just another method.

ok, C# apparently supports operator overloading as well

and yet you never use it so maybe it's not as virulent as you think

Jonny 290 posted:

i dont totally get why the overloading thing is such a thing

is it really that useful? i mean i get the ideas of simple indicators of complex things like vector multiplies, and why it'd be easy to work with, but how often is it really used

in math heavy code, literally everywhere

computer math isn't so different from paper math that way, it's not like mathematicians couldn't write out "clockwise integral over a closed loop" instead of a tall S with a circle in it, but if they did it would make every equation really long

hopefully some pedant points out you would never overload an operator to do that so I can paste a line of FEM code where replacing the unary ops with .multiply/.add etc would increase its length 500%

flashbacks to grad school here, yospos is a bad trip tonight

skeevy achievements fucked around with this message at 05:02 on Mar 1, 2013

rotor
Jun 11, 2001

classic case of pineapple on pizzadog derangement syndrome

Jonny 290 posted:

i dont totally get why the overloading thing is such a thing

is it really that useful? i mean i get the ideas of simple indicators of complex things like vector multiplies, and why it'd be easy to work with, but how often is it really used

"augh typing is so hard I hate it!. I'm not writing a novel here!" - why people love operator overloading

Adbot
ADBOT LOVES YOU

spongeh
Mar 22, 2009

BREADAGRAM OF PROTECTION
http://ashkenas.com/literate-coffeescript/

ahhaahhhahaah

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