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
Workaday Wizard
Oct 23, 2009

by Pragmatica

Kevin Mitnick P.E. posted:

because throws IOException is super useful and i totally know wtf is going on when i see it on a method

same but return Either(Ok(value),Error(IOException))

e: hello new page, what's the actual difference between "() -> Either(Ok(T), Error(E))" and "() -> T throws E"
isn't the latter sugar for the former?

Adbot
ADBOT LOVES YOU

Vanadium
Jan 8, 2005

the latter probably goes faster because T is smaller than a weird potentially nested algebraic type

Shaggar
Apr 26, 2006

Kevin Mitnick P.E. posted:

because throws IOException is super useful and i totally know wtf is going on when i see it on a method

ioexceptions can maybe be retried a reasonable amount of times, but certain ones (ex: FileNotFoundException) are critical to handle so you can alert a hu-mon to fix the problem.

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

ioexceptions can maybe be retried a reasonable amount of times, but certain ones (ex: FileNotFoundException) are critical to handle so you can alert a hu-mon to fix the problem.

and if the method is declared throws IOException then you need to look at the javadoc or the source to determine whether it throws something you care about, which goes back to my original point. what you need to know isn't just some types that may be thrown, but also under what conditions. if you don't have both pieces you can't make an informed decision on whether to handle an exception or let it propagate. you have to look at the javadoc anyway

Shinku ABOOKEN posted:

same but return Either(Ok(value),Error(IOException))

e: hello new page, what's the actual difference between "() -> Either(Ok(T), Error(E))" and "() -> T throws E"
isn't the latter sugar for the former?

the difference is javac is a prick about the latter

Bloody
Mar 3, 2013

last time exceptions came up we realized that a common ground should exist and that neither exclusively checked nor unchecked is the true correct approach

Nomnom Cookie
Aug 30, 2009



the more i think about considerations when programming in large teams, the more i think the correct approach is intoxication

HORATIO HORNBLOWER
Sep 21, 2002

no ambition,
no talent,
no chance

Kevin Mitnick P.E. posted:

the more i think about considerations when programming in large teams, the more i think the correct approach is intoxication

same but more so for small teams

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

checked exceptions are like mid-80s copy protection: what's the third word in the description of the third method in the javadoc? oh, ok, simon says you can compile. (btw, the exceptional condition might be something like "read to end of file", which is hardly an exceptional situation when reading a file.)

why don't the Java standard collections use the better form and make checked exceptions propagate? that's pretty weak, given how central exception specifications are to Java API design.

americong
May 29, 2013


how does the pos feel about go

it seems like it's the first general purpose language in a long goddamn time to have an original thought on how to program, except that the thoughts aren't original, except it's the people who came up with the ideas thirty years ago who are implementing it

Mr. Glass
May 1, 2009
i like it practically but find its type system lacking

americong
May 29, 2013


Mr. Glass posted:

i like it practically but find its type system lacking

everyone who says that to the devs gets told that the types are barebones on purpose

I've hosed around in it a little and didn't hate the types, just had to be slightly more careful

I also think big fancy types systems are lame as h*ck

b0lt
Apr 29, 2005
im a big fan of collections that force you to cast to void*

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

I abandoned a project once upon encountering void **** in internal API. I believe that code still runs in critical parts of many Linux distributions (rpm).

(it also had delightful matching of specific package names/versions to tweak behavior, often long after rpm would no longer build on the system that used the package in question.)

americong
May 29, 2013


hmm.......perl is good, very good..hmm

jony neuemonic
Nov 13, 2009

americong posted:

hmm.......perl is good, very good..hmm

Mr. Glass
May 1, 2009

b0lt posted:

im a big fan of collections that force you to cast to void*

basically this

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Soricidus posted:

conversely, about three hours ago I helped a colleague track down a nasty bug in some dynamically-typed code that would have been detected immediately by a type checker.

(they were passing a string to a function that expected a list; thanks to the magic of duck typing, the program silently did the wrong thing.)

if this is python I'm really impressed because the opposite sounds a lot more likely to produce a silent bug (passing a list of strings to a function that expects a string).

Max Facetime
Apr 18, 2009

Subjunctive posted:

why don't the Java standard collections use the better form and make checked exceptions propagate? that's pretty weak, given how central exception specifications are to Java API design.

the impression I got was that java 8's development was a total clusterfuck and years and years late. like the syntax for lambdas was essentially decided sometime in 2009! I guess they must have always felt that java 8 was always only some 6-9 months from release; never close enough so you could have that final round of polish but also never so far away that you could entertain a completely different approach. to get the thing out the door meant that features just had to be dropped

then there's the reasons for the lateness. apparently getting the type system working well with just one generic return value type and all it implies is really hard already. who knows if checked exceptions would fit into this type system at all? (well of course they would, but when...)

also, having followed some compiler issues it looks very much like the standard compiler is providing more features and plain convenience than a careful reading of the standard should allow it. so before tackling exceptions you really should get that pesky type system fully worked out first. which is still really hard. or you nerf the compiler. which is really stupid

and finally, this is the part I really like. it turns out that with these lazy functional stream processors designed first and foremost for efficient parallel computing where exceptions aren't meant to be handled at all, you strike a lot more gold than you even realize. the new way is better than the old collections way for many tasks it wasn't even designed for, but there's just no way a reworking of collections would fit into the java 8 schedule, so you do what you can and

that's how we end up with the :horse: cart before the donkey and the jockey before that

Nomnom Cookie
Aug 30, 2009



lambdas were supposed to be in 7 but people couldn't agree on the syntax. and my experience with parallelStream has been that it's about as useful as any other kind of parallelism fairy dust

Luigi Thirty
Apr 30, 2006

Emergency confection port.

the borland turbo c source code to some old shareware game got posted on the internet, any way to get that to compile on a modern computer

pseudorandom name
May 6, 2007

dosbox and the turbo c compiler

Luigi Thirty
Apr 30, 2006

Emergency confection port.

do compilers work in dosbox? i would have thought they wouldn't work in an emulated environment that's not 100% identical to the real hardware for whatever reason

americong
May 29, 2013


Luigi Thirty posted:

do compilers work in dosbox? i would have thought they wouldn't work in an emulated environment that's not 100% identical to the real hardware for whatever reason

please mspaint your suspected differences relevant to a compiler

Luigi Thirty
Apr 30, 2006

Emergency confection port.

americong posted:

please mspaint your suspected differences relevant to a compiler

i don't know i've never written a compiler i just use them mang it says "supports most opcodes and math isn't accurate without libc but good enough for games" maybe they're important opcodes!!!

americong
May 29, 2013


Luigi Thirty posted:

i don't know i've never written a compiler i just use them mang it says "supports most opcodes and math isn't accurate without libc but good enough for games" maybe they're important opcodes!!!

then write a compiler dipfuck it's worth your time

Luigi Thirty
Apr 30, 2006

Emergency confection port.

sry on the first pass my compiler reduced your posting to 1

Mr. Glass
May 1, 2009

Luigi Thirty posted:

do compilers work in dosbox? i would have thought they wouldn't work in an emulated environment that's not 100% identical to the real hardware for whatever reason

aaaahhhhhhhhhh i just can't with this

Luigi Thirty
Apr 30, 2006

Emergency confection port.

sorry that i don't know how to write a compiler i guess!!!

gonadic io
Feb 16, 2011

>>=
code:
This \"function\" has a superficial similarity to 'unsafePerformIO' but
-- it is in fact a malevolent agent of chaos. It unpicks the seams of reality
-- (and the 'IO' monad) so that the normal rules no longer apply. It lulls you
-- into thinking it is reasonable, but when you are not looking it stabs you
-- in the back and aliases all of your mutable buffers. The carcass of many a
-- seasoned Haskell programmer lie strewn at its feet.
--
-- Witness the trail of destruction:
--
-- * <[url]https://github.com/haskell/bytestring/commit/71c4b438c675aa360c79d79acc9a491e7bbc26e7[/url]>
--
-- * <[url]https://github.com/haskell/bytestring/commit/210c656390ae617d9ee3b8bcff5c88dd17cef8da[/url]>
--
-- * <[url]https://ghc.haskell.org/trac/ghc/ticket/3486[/url]>
--
-- * <[url]https://ghc.haskell.org/trac/ghc/ticket/3487[/url]>
--
-- * <[url]https://ghc.haskell.org/trac/ghc/ticket/7270[/url]>
--
-- Do not talk about \"safe\"! You do not know what is safe!
--
-- Yield not to its blasphemous call! Flee traveller! Flee or you will be
-- corrupted and devoured!
--
{-# INLINE accursedUnutterablePerformIO #-}
accursedUnutterablePerformIO :: IO a -> a
accursedUnutterablePerformIO (IO m) = case m realWorld# of (# _, r #) -> r

Slurps Mad Rips
Jan 25, 2009

Bwaltow!

Luigi Thirty posted:

sorry that i don't know how to write a compiler i guess!!!

may b u should ask some1 how a compiler works and then u can write a compiler

Sapozhnik
Jan 2, 2005

Nap Ghost

Luigi Thirty posted:

sorry that i don't know how to write a compiler i guess!!!

most compilers are cross compilers (i.e. the compiler is a program that can be compiled to run on architecture X but generate binaries for architecture Y, where sometimes X = Y but not necessarily) these days :)

Luigi Thirty
Apr 30, 2006

Emergency confection port.

SAHChandler posted:

may b u should ask some1 how a compiler works and then u can write a compiler

but... how...did the first compiler... compile itself? :vince:

americong
May 29, 2013


Luigi Thirty posted:

but... how...did the first compiler... compile itself? :vince:

kill yourself, then consider that writing a functional compiler in machine code or assembler isn't really that hard, thanks

Luigi Thirty
Apr 30, 2006

Emergency confection port.

americong posted:

kill yourself, then consider that writing a functional compiler in machine code or assembler isn't really that hard, thanks

that was sarcasm hence the :vince: keep right on being a belligerent rear end

americong
May 29, 2013


Luigi Thirty posted:

that was sarcasm hence the :vince: keep right on being a belligerent rear end

yospos bithc

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
compilers are neat and I feel like a better person for having written one in school

americong
May 29, 2013


uncurable mlady posted:

compilers are neat and I feel like a better person for having written one in school

same

Luigi Thirty
Apr 30, 2006

Emergency confection port.

my college was terrible and i wasted $20,000 on a program that didn't have me do that and it doesn't seem like a thing you should really try to teach yourself

anyway the last time i was looking up something to do with assembly language i found a forum full of crazy people who are convinced microsoft is paying norton to delete programs compiled by MASM so that's my story

Luigi Thirty fucked around with this message at 04:40 on Aug 3, 2014

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

why not? you don't have to rewrite gcc from scratch or something to write "a compiler"

Adbot
ADBOT LOVES YOU

americong
May 29, 2013


just read the aho sethi ullman book (or at least that's what mostly everyone does) and learn the baby subset of assembly you need

honestly programmers should all have an understanding of assembly and other low level poo poo, or at least the relevant parts like locality

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