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
tef
May 30, 2004

-> some l-system crap ->

Bloody posted:

volatile makes it work yeah but i dunno i feel like it shouldn't be necessary in this case


Subjunctive posted:

this is like the classic example of when to use volatile: there's a mutation that's not visible to the control flow. otherwise it could never hoist any loads, it'd have to rematerialize every time through the loop, you would cry yourself to sleep, etc.

yep

volatile: "this value lives in memory and must be fetched each time" this is exactly where you're meant to use volatile

fun fact: some bits in ruby c ext require volatile as not to let objects get gc'd, and i think php used it to fix floating point errors because intel fp registers have 80 bits :v:

Adbot
ADBOT LOVES YOU

brap
Aug 23, 2004

Grimey Drawer

Blotto Skorzany posted:

a stock photo (intended to be artsy by being out of focus and having an anachronistic subject) with some bloom applied and dumb text added

but enough about your posting

FamDav
Mar 29, 2008
wrong thread but bump i guess

Workaday Wizard
Oct 23, 2009

by Pragmatica
your programming language is a piece of poo poo

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

tef posted:

yep

volatile: "this value lives in memory and must be fetched each time" this is exactly where you're meant to use volatile

fun fact: some bits in ruby c ext require volatile as not to let objects get gc'd

this is an amazing feature of objective-c gc too, for basically the same reason except not just in ffi code but everywhere, surprise, have fun reasoning like a compiler

tef posted:

and i think php used it to fix floating point errors because intel fp registers have 80 bits :v:

this isn't supposed to be necessary but the language rules about using wider semantics are somewhat vague and compilers are generally pretty crappy about actually implementing them

we didn't really care in llvm/clang until we realized how good fma formation is (it's really loving good)

tef
May 30, 2004

-> some l-system crap ->
is it wrong to like clang because the entire reason it exists is to annoy stallman

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

tef posted:

is it wrong to like clang because the entire reason it exists is to annoy stallman

that is the best reason

it is not actually true but it is still the best reason

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

when is the best reason ever true?

Deacon of Delicious
Aug 20, 2007

I bet the twist ending is Dracula's dick-babies
what are RMS's thoughts on clang. just how much does it irritate him

Notorious b.s.d.
Jan 25, 2003

by Reene

Deacon of Delicious posted:

what are RMS's thoughts on clang. just how much does it irritate him

for many years gcc's intermediate representation has been undocumented and deliberately made hard to use. the goal was to avoid letting proprietary frontends use gcc's compiler backend or vice versa

clang and llvm exist so that was all completely pointless

Suspicious Dish
Sep 24, 2011

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

Deacon of Delicious posted:

what are RMS's thoughts on clang. just how much does it irritate him

https://gcc.gnu.org/ml/gcc/2014-01/msg00247.html

Deacon of Delicious
Aug 20, 2007

I bet the twist ending is Dracula's dick-babies

i am both and NSA and an FBI agent, so i stopped reading after the foreword and now i'm off following snowden's example. did i miss anything

Bloody
Mar 3, 2013


quote:

[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
mods, all of this please

Bloody
Mar 3, 2013

Bloody posted:

mods, all of this please

wasnt snowden's example to inform the public about the egregious overstepping of boundaries and invasions of privacies being performed?

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

rjmccall posted:

that is the best reason

it is not actually true but it is still the best reason

Deacon of Delicious
Aug 20, 2007

I bet the twist ending is Dracula's dick-babies
thanks for the background info. i basically have the same question:

tef posted:

is it wrong to like clang because the entire reason it exists is to annoy stallman

except i'm going to go ahead answer it "no, lol"

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Bloody posted:

mods, all of this please

cool idea

Soricidus
Oct 21, 2010
freedom-hating statist shill

Bloody posted:

wasnt snowden's example to inform the public about the egregious overstepping of boundaries and invasions of privacies being performed?

i think rms is probably referring to the running-away-to-china-and-then-russia part

also the leaking millions of documents you haven't even read because you think there's probably bad stuff in them somewhere, that was a good example that everyone should follow

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Soricidus posted:

also the leaking millions of documents you haven't even read because you think there's probably bad stuff in them somewhere, that was a good example that everyone should follow

this but unironically

qntm
Jun 17, 2009

Notorious b.s.d. posted:

for many years gcc's intermediate representation has been undocumented and deliberately made hard to use. the goal was to avoid letting proprietary frontends use gcc's compiler backend or vice versa

tbh possibly the least bad thing ever done in the name of freedom

Notorious b.s.d.
Jan 25, 2003

by Reene
there was a time when that goal was sensible, and that time is long past

Sapozhnik
Jan 2, 2005

Nap Ghost
well yeah because back in the days of GNU's early victories computers were niche nerd poo poo whereas these days lol if you think the beard and sandals brigade is going to be able to push back against the agenda of private interests w/ 100 billion dollars

in the 90s the only real moneyed juggernaut in the technology space was microsoft and guess what, open sores poo poo was completely irrelevant in the desktop pc market during this time

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
GNU's whole vision was based on Doug Engelbart and Ted Nelson being wrong

MononcQc
May 29, 2007

Well chorded keyboards lost, so in your face Engelbart

Coffee Mugshot
Jun 26, 2010

by Lowtax
The documentation is the source code idiots

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
https://blog.golang.org/errors-are-values

here's an idiom that makes it incredibly easy to just blithely ignore errors. you should use this, even though the language has no support for this idiom, and the compiler will give you zero help in finding the places where you're missing error checks, and the idiom absolutely encourages you to execute arbitrary amounts of code after the failure site

also check out this wicked insight: errors are values, checkmate motherfuckers

but remember, always check for errors, because this is your problem and we can't do poo poo about it

Arcsech
Aug 5, 2008

rjmccall posted:

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

here's an idiom that makes it incredibly easy to just blithely ignore errors. you should use this, even though the language has no support for this idiom, and the compiler will give you zero help in finding the places where you're missing error checks, and the idiom absolutely encourages you to execute arbitrary amounts of code after the failure site

also check out this wicked insight: errors are values, checkmate motherfuckers

but remember, always check for errors, because this is your problem and we can't do poo poo about it

now that rust is semi stable is there any reason to use go at all

Vanadium
Jan 8, 2005

same reasons you had to use go before rust was semi stable, they don't really compete

brap
Aug 23, 2004

Grimey Drawer
there's no reason to use either op.

Notorious b.s.d.
Jan 25, 2003

by Reene

Vanadium posted:

same reasons you had to use go before rust was semi stable, they don't really compete

so there was never a reason to use go, then?

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

rjmccall posted:

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

here's an idiom that makes it incredibly easy to just blithely ignore errors. you should use this, even though the language has no support for this idiom, and the compiler will give you zero help in finding the places where you're missing error checks, and the idiom absolutely encourages you to execute arbitrary amounts of code after the failure site

also check out this wicked insight: errors are values, checkmate motherfuckers

but remember, always check for errors, because this is your problem and we can't do poo poo about it

lol. nobody has come up with a better way to handle errors than exceptions and this garbage sure isn't it

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Golang faq posted:

Why does Go not have exceptions?

We believe that coupling exceptions to a control structure, as in the try-catch-finally idiom, results in convoluted code. It also tends to encourage programmers to label too many ordinary errors, such as failing to open a file, as exceptional.

failing to open a file is just a boring old regular error, you don't want to use an exception for that. happens all the time

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
To be fair, it doesn't really matter if poo poo programmers forget to handle the exception or not check the error code.

Sapozhnik
Jan 2, 2005

Nap Ghost
it does though, that's the whole point of exceptions

yolo an exception: ur application crashes immediately
yolo a returned error: ur application stumbles around with half its head missing for a little while and then falls over dead somewhere else unrelated to the root cause of the problem

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

goto fail

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
I'm assuming if you don't handle the error and try to do something with the file it'll also crash?

I do agree with you I'd probably enjoy a FileNotFoundException more than a random 'segmentation fault' but then I never understood why people would want to use Go anyway. Who needs a debugger, am I right?

Peanut and the Gang
Aug 24, 2009

by exmarx

Mr Dog posted:

it does though, that's the whole point of exceptions

yolo an exception: ur application crashes immediately
yolo a returned error: ur application stumbles around with half its head missing for a little while and then falls over dead somewhere else unrelated to the root cause of the problem

Crash early, crash often. Spin up again when something fatal happens.

Arcsech
Aug 5, 2008

Tiny Bug Child posted:

lol. nobody has come up with a better way to handle errors than exceptions and this garbage sure isn't it

option types


Peanut and the Gang posted:

Crash early, crash often. Spin up again when something fatal happens.

this is the other good answer but it is only good in certain applications, and is easily compatible with option types

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Arcsech posted:

option types

you don't need a fancy "type" system to return null when you run into a problem, and in any case that is in no way cleaner than throwing an exception

Adbot
ADBOT LOVES YOU

MononcQc
May 29, 2007

Option types isn't the one true God of exceptions. Copying a rant from an earlier page:

MononcQc posted:

I know your stance on exceptions in general, but what if you have different classes of exception handling mechanisms available for each of these cases? What about languages that may support exceptions, option types, tagged values, multiple return values, signals, continuations and/or whatever mix of them that exists?

I understand it's very well possible to have a favorite one (say option types), and to pretend that you have to pick only this one in ideal cases, but when faced in a language that offers more than one way to do it, can you still affirm only one of them is the one true form to be used for all cases available?

"One true form of exception handling", to me, sounds as reductionist of an approach as "one true form of concurrency", "one true programming language paradigm", or whatever. This is to say, it's perfectly fine to be opinionated about it and kitchen sink languages might be terrible, but there will be areas where one or more of them is better than some single other.

The general principles for fault tolerance require Separation of Concerns vis. Error Encapsulation (make sure that the contagion doesn't spread), Fault Detection (make sure that you know that someone is infected), and Fault Identification (you have ebola, son).

Error encapsulation (and this applies equally to modules, components, systems, architectures, organizations) is invariably best done at the lowest level possible, which invariably breaks #3 and #4 (fault detection and identification).

Treating all error conditions / exceptions with the same mechanism will generally ensure that you pick similar stances on encapsulation vs. detection and identification for all error conditions / exceptions, unless you decide to be extra careful about all of that.

Using multiple mechanisms will allow you to pick, case by case, which one you feel is worth breaking depending on the nature of the fault and what your specific application or system requires.

Option types are pretty awesome, but they're not blanked replacements for other mechanisms IMO. Context is king.

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