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
hepatizon
Oct 27, 2010

rjmccall posted:

hmm. i wouldn't call it horrible, but i do think it's fair to call the type system a hack because of how idiosyncratic it feels in practice. there are blogposts telling you how to structure your scala apis in order to get type inference to work better for your callers. i understand and sympathize with not wanting an even more complex type checker, but to me, scala's type system crosses the line of no longer being readily comprehensible to non-savants while still having some embarrassing lapses in its ability to type reasonable programs

bi-di systems do deserve to be listed as their own strategy, but they're still relatively uncommon in major languages, and in my experience they, well, tend to end up like scala's if you're not careful. it's a technique that makes it really easy to pile up quasi-principled hacks to make the next interesting testcase work. swift started off with a bi-di checker and it just got completely out of control; that's definitely our fault, but it left a bad taste in my mouth

thanks for these posts, i still don't follow all the terminology (e.g. 'type abstraction') but they are closer to comprehensible than anything else i've found

Adbot
ADBOT LOVES YOU

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Symbolic Butt posted:

is it just me or ruby code rarely have any comments? at least this has been my experience with ruby code. "my code is elegant and self-evident why ever comment anything? :smug:"

comments are lame, i'm a web "developer" wizard ninja cowboy

Soricidus
Oct 21, 2010
freedom-hating statist shill
no need for comments, just read the unit tests if you want to know what this code is for, what its contract is, what complexity guarantees it makes, etc

just lol if you bother documenting your code except with other undocumented code

Sapozhnik
Jan 2, 2005

Nap Ghost
oh poo poo i actually remember being in the blast radius of a queue-related mega-fuckup a while back and holy poo poo it was not fun for the people who had to actually clean up that particular exploded whale carcass

an Oracle replication link between London and Hong Kong got hella backlogged and I think they had to halt trading for a while. You can't really do load-shedding with financial poo poo

I mean I guess you can but then the FSA gets slightly upset

Zombywuf
Mar 29, 2008

Well you can if you're a retail bank and already so clusterfucked that people have just come to expect it of you. Mentioning no Royal banks in particular.

Zombywuf
Mar 29, 2008

But yeah, refusing to accept any transaction orders (or disabling your cash points) is just load shedding really.

Sapozhnik
Jan 2, 2005

Nap Ghost
no, it's back-pressure

it exerts back-pressure by demonstrating what a bad idea it is to continue to do business with you, thereby permanently reducing your future load

in this particular case it wasn't even that, it just meant that the traders couldn't trade and keep their trades hedged correctly, so their portfolio would just take a massive poo poo and there was nothing they could do about it.

(this wasn't RBS, this was a trading desk at an investment bank)

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

we once DoSed the Android push service because we had bad backoff math in the token registration code for the Android Facebook client; copied from their sample at the time, I think. had to kill-switch notification stuff remotely while we pushed a fix, Google were unhappy when they called.

I asked why they didn't just drop when things were excessive, but that didn't make them any happier.

suffix
Jul 27, 2013

Wheeee!
i'm playing spacechem right now and therefore i too can relate to queue chat

imo just make a really long pipe so it won't fill up before level complete

Zombywuf
Mar 29, 2008

Mr Dog posted:

(this wasn't RBS, this was a trading desk at an investment bank)

yeah, I was just referencing RBS's repeated clusterfucks, because, well, RBS

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

hepatizon posted:

thanks for these posts, i still don't follow all the terminology (e.g. 'type abstraction') but they are closer to comprehensible than anything else i've found

glad you're getting something out of it

"abstraction" here just generalizes the idea of a function. an abstraction starts with an expression that's been written in terms of an unknown X and then "abstracts" it over X, producing something that can't be further evaluated until you tell it what X is, which is done by the corresponding "application". a value abstraction is an abstraction where X is some type of value, and (in a typed language) you have to say what type it is, and the application just says what value to use for X, at which point you can evaluate the sub-expression; in other words, it's just an ordinary function, and the corresponding application is just ordinary function call. a type abstraction is therefore an abstraction where X is some kind of type, and (sometimes) you have to say what kind it is, and the application just says what type to use for X; in other words, the abstraction makes something polymorphic, and the application produces a copy of the polymorphic thing which is specialized for a given type

conventionally both are written like lambdas. if you're using greek, value abstractions get the lowercase lambda and type abstractions get the uppercase; if you're using ascii, the most common convention I've seen (due to Pierce) is that both get backslashes and you disambiguate in some other way, usually by leaving off the type kind or assuming that the reader can easily disambiguate a kind and a type. so e.g. you might write the polymorphic identity function as \T . \x:T . x, where the first clause starts a type abstraction binding T and the second clause starts a value abstraction binding x. in academic literature, type applications usually use square brackets instead of parentheses; so you might call that polymorphic identity function as id[Int](0)

to make this somewhat more concrete, consider the following haskell code:

code:
flip :: (a -> b -> c) -> (b -> a -> c)
flip f x y =  f y x

subtractInt :: Int -> Int -> Int
subtractInt =  flip (-)
if we were programming directly in pseudo system f, we might write this out super-explicitly like so:

code:
flip :: forall a . forall b . forall c . (a -> b -> c) -> (b -> a -> c)
flip = \a . \b . \c . \f:a->b->c . \x:b . \y:a . f(y)(x)

subtractInt :: Int -> Int -> Int
subtractInt = flip[Int][Int][Int](Int.-)
haskell's type system automatically infers type applications when you're calling a polymorphic function (which it can do reliably only because it's less general than full system f) and inserts type abstractions when you're defining a polymorphic function (which it knows by a simple syntactic rule: lowercase type names in haskell are always type variables that need to be abstracted over)

gonadic io
Feb 16, 2011

>>=

http://www.wilfred.me.uk/blog/2014/10/20/the-fastest-bigint-in-the-west/ posted:

The slowest BigInt here is PHP. PHP implements its arbitrary size arithmetic in C. However, it doesn’t have a BigInt data type, so its arbitrary size numerical functions take and return strings!

really? really?

gonadic io fucked around with this message at 23:59 on Oct 20, 2014

gonadic io
Feb 16, 2011

>>=
this doesn't matter because nobody uses bigints - tbc

gonadic io fucked around with this message at 23:59 on Oct 20, 2014

Zombywuf
Mar 29, 2008

Well, if you think about it, a bigint is just an array of bytes and a string is just an array of bytes.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

AlsoD posted:

really? really?

you know, I think it's not the only base 10 bignum library I've ever seen. ofc all libraries worth poo poo are base 256

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
imo things like numeric types and data types and so on should all be handled by the processor architecture

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

MALE SHOEGAZE posted:

imo things like numeric types and data types and so on should all be handled by the processor architecture

No register wide enough for your poo poo posts

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

google put out a preview of Lollipop, including their new VM, ART. they tout its AOT compiler, which is intended to improve app startup speed.

3 of the 4 top Android apps start up more slowly, visibly so on the mid-range phone I saw.

Max Facetime
Apr 18, 2009

rjmccall posted:

so e.g. you might write the polymorphic identity function as \T . \x:T . x,

. . . or . . .

here's a crazy thought, you could use a pseudo code that's also usually actually valid real code:

Java code:
	static <T> Function<T, T> identity() {
		return t -> t;
	}
or
Java code:
	static <T> T identity(T t) {
		return t;
	}
(whichever is the same as that greek)

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Max Facetime posted:

. . . or . . .

here's a crazy thought, you could use a pseudo code that's also usually actually valid real code:

Java code:

	static <T> Function<T, T> identity() {
		return t -> t;
	}
or
Java code:

	static <T> T identity(T t) {
		return t;
	}
(whichever is the same as that greek)

that's actually very similar to the ghc core or idris type theory core

makes sense when there's a lot of lambdas

Max Facetime
Apr 18, 2009

Max Facetime posted:

Java code:
	static <T> T identity(T t) {
		return t;
	}

and the craziest thing about that code there is:

the tokens 'static', '<', '>', '(', ')', '{', 'return', ';', '}' are just syntax, so you might as well just use those because it makes for a clear syntax

and

the token 'identity' is just an extra symbol, which means all these other functions are the identity function too:
Java code:
	static <T> T id(T t) { return t; }
	static <T> T same(T t) { return t; }
	static <T> T self(T t) { return t; }
	static <T> T passthrough(T t) { return t; }
	static <T> T one(T t) { return t; }
so you might just as well have the word 'identity' there to be able to refer to it later without having to type it again

Cybernetic Vermin
Apr 18, 2005

there is something to be said for abstracting away from the details of the thing you are analyzing though. notation is often flawed, but minimalistic mathematical notation has upsides in that it does not bring with it any interfering mental model

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Max Facetime posted:

and the craziest thing about that code there is:

the tokens 'static', '<', '>', '(', ')', '{', 'return', ';', '}' are just syntax, so you might as well just use those because it makes for a clear syntax

and

the token 'identity' is just an extra symbol, which means all these other functions are the identity function too:
Java code:

	static <T> T id(T t) { return t; }
	static <T> T same(T t) { return t; }
	static <T> T self(T t) { return t; }
	static <T> T passthrough(T t) { return t; }
	static <T> T one(T t) { return t; }

so you might just as well have the word 'identity' there to be able to refer to it later without having to type it again

lol

gonadic io
Feb 16, 2011

>>=
I bet ur lambda calc doesn't even have proper exception handling or multithreading either

qntm
Jun 17, 2009

AlsoD posted:

really? really?

tell me php does bigint arithmetic using an adaptation of the by-hand long addition process

tell me it literally carries the one

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

suffix posted:

i'm playing spacechem right now and therefore i too can relate to queue chat

imo just make a really long pipe so it won't fill up before level complete

you wont get in to the high scores table like that!

gonadic io
Feb 16, 2011

>>=

KARMA! posted:

you wont get in to the high scores table like that!

it's like 5 years after the game was released at this point, those high score tables must be impossible

Cybernetic Vermin
Apr 18, 2005

plus the high score solutions will seldom be terribly elegant, relying on fragile timing tuning. p. subjective granted, but playing spacechem trying to beat the records is a bit too deep into the sperg for most even when it comes to that game

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Max Facetime posted:

. . . or . . .

here's a crazy thought, you could use a pseudo code that's also usually actually valid real code:

:supaburn:

on top of what everybody else said, the lambda-calc syntax also reinforces my point about the essential similarity of the two kinds of abstraction, instead of making them look completely different

also, lambda syntax is hilariously varied between real languages, and assuming that anybody is going to recognize one in particular, especially's java's, is a bad way to go

also, you are literally so damaged by java that you can't stop yourself from putting unnecessary statics in your pseudocode, that is some shameful poo poo

Bloody
Mar 3, 2013

Maybe, like, the happy medium of syntax is somewhere between Java and whatever the gently caress that abstract art up there was

(it's c#. As usual, the answer to anything at all itt is c#.)

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
i really like c#'s lambda syntax and have no idea how the rest of my team got so sold on swift's current horror

ok, that's not true, they wanted something that felt like it seamlessly scaled all the way down to bare braces and $0 syntax, but frankly that was probably a mistake

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

AlsoD posted:

really? really?

lol yeah all the bcmath functions take and return numerical strings. this is actually really handy for some things and it wouldn't be a problem except the actual implementation is so slow. but imo that shouldn't be a concern for the ppl making or using the language; it's the job of the nerds who make interpreters and hardware to make things fast

anyway when i took crypto in college i was the only guy that used PHP. i had to let my RSA script run overnight but it worked

Star War Sex Parrot
Oct 2, 2003

C++ code:
auto f = [](auto x){ return func(normalize(x)); };
:allears:

brap
Aug 23, 2004

Grimey Drawer

rjmccall posted:

i really like c#'s lambda syntax and have no idea how the rest of my team got so sold on swift's current horror

ok, that's not true, they wanted something that felt like it seamlessly scaled all the way down to bare braces and $0 syntax, but frankly that was probably a mistake

it's absurdly terse but maybe pointless to obscure the number of arguments to an anonymous function

FamDav
Mar 29, 2008

Star War Sex Parrot posted:

C++ code:
auto f = [](auto x){ return func(normalize(x)); };
:allears:

i've come to decide that auto is really harmful beyond using it for iterators.

sarehu
Apr 20, 2007

(call/cc call/cc)
you're just a software conservative.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Bloody posted:

(it's c#. As usual, the answer to anything at all itt is c#.)
what is a bad language that nobody should ever use?

Bloody
Mar 3, 2013

Soricidus posted:

what is a bad language that nobody should ever use?

Php python ruby Javascript Haskell erlang Java ocaml go f# scala there's probably more but that's a good start

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

yo in the arse technica review of yosemite there was a mostly glowing review of swift, i don't know enough about programming to know what they were really talking about but something about it felt very off, can someone explain

Adbot
ADBOT LOVES YOU

Bloody
Mar 3, 2013

Captain Foo posted:

yo in the arse technica review of yosemite there was a mostly glowing review of swift, i don't know enough about programming to know what they were really talking about but something about it felt very off, can someone explain

Swift is a bad language for idiots, hth

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