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
Bonfire Lit
Jul 9, 2008

If you're one of the sinners who caused this please unfriend me now.

TooMuchAbstraction posted:

I've heard there are good technical-difficulty reasons why implementing generics is so hard, but I haven't heard what those reasons are.
I haven't. The most technical reason I've heard is that generics lead to binary bloat because apparently the go linker is incapable of merging functions with identical code, so instead just copy and paste your data type implementations or do external code generation which will avoid that problem because of oh poo poo look at the time I have to be elsewhere.

Adbot
ADBOT LOVES YOU

Soricidus
Oct 21, 2010
freedom-hating statist shill
or do type erasure, which is kind of like interface{} but with compiler type checking

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
everyone involved with golang spends too much time talking past everyone else involved with golang

golang was designed to be useful to google. millions of cargo cult nerds latched on to it, like they do with everything google does, and then wonder where their features are. at the end of the day, the people who are screaming about golang generics would probably be better off using another language to begin with.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

uncurable mlady posted:

golang was designed to be useful to google. millions of cargo cult nerds latched on to it, like they do with everything google does, and then wonder where their features are. at the end of the day, the people who are screaming about golang generics would probably be better off using another language to begin with.

What you're missing here is how many SWEs at Google are screaming for Go to get generics.

Eela6
May 25, 2007
Shredded Hen

uncurable mlady posted:

everyone involved with golang spends too much time talking past everyone else involved with golang

golang was designed to be useful to google. millions of cargo cult nerds latched on to it, like they do with everything google does, and then wonder where their features are. at the end of the day, the people who are screaming about golang generics would probably be better off using another language to begin with.

I am paid to write golang. If I got to use Python or Elixir or something I would, but I am not paid to write those. My boss has his reasons for choosing Go. I don't necessarily agree, but I'm not the boss. . You can say "well then get another job" but that's a bit pat.

I like my job, even if golang drives me nuts. Of golang had generics I could like my job and tolerate golang a little better!

ExcessBLarg!
Sep 1, 2001

eschaton posted:

GCC 4.2.1 and earlier will always need to be accommodated, because of the switch to GPLv3 after that version
Why is the license relevant? libstdc++ or something?

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
Some organizations will not touch anything GPLv3, for a variety of reasons. You should be able to derive some of those reasons from the differences between GPLv2 and GPLv3. (I'm not really able to speculate on what reasons apply for mine.)

JewKiller 3000
Nov 28, 2006

by Lowtax
generics are not hard to implement if you're talking about just straight up parametric polymorphism in a functional language. it's almost a natural consequence of hindley-milner style type inference. the hard part is making it interact well with a subtype-heavy object-oriented language. that's why java has bounded type parameters, which can be difficult to understand, and even the java implementers didn't get it right

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.
I've been intrigued for a while with the idea of a purely consequential type system. A type is just a collection of methods implemented. If a function takes a parameter x and somewhere calls x.sum, then the inferred type of a is anything that implements sum. Sure you can define a type by name, but it's really just an alias for the interface the individual members must implement. It seems like you'd get all the benefits of compile time type checking, while still being able to write code as if it were a dynamic typed language.

I'm sure any actual implementation would be a horror in its own way, but from here it seems like a good idea.

Spatial
Nov 15, 2007

Welcome to C++

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.

KernelSlanders posted:

I've been intrigued for a while with the idea of a purely consequential type system. A type is just a collection of methods implemented. If a function takes a parameter x and somewhere calls x.sum, then the inferred type of a is anything that implements sum. Sure you can define a type by name, but it's really just an alias for the interface the individual members must implement. It seems like you'd get all the benefits of compile time type checking, while still being able to write code as if it were a dynamic typed language.

I'm sure any actual implementation would be a horror in its own way, but from here it seems like a good idea.

That sounds like row polymorphism, really.

Absurd Alhazred
Mar 27, 2010

by Athanatos

KernelSlanders posted:

I've been intrigued for a while with the idea of a purely consequential type system. A type is just a collection of methods implemented. If a function takes a parameter x and somewhere calls x.sum, then the inferred type of a is anything that implements sum. Sure you can define a type by name, but it's really just an alias for the interface the individual members must implement. It seems like you'd get all the benefits of compile time type checking, while still being able to write code as if it were a dynamic typed language.

I'm sure any actual implementation would be a horror in its own way, but from here it seems like a good idea.

Structural typing seems to be what you're describing. It's used by OCaml, Go, and you can also do this with templates in C++, actually.

eth0.n
Jun 1, 2012

KernelSlanders posted:

I've been intrigued for a while with the idea of a purely consequential type system. A type is just a collection of methods implemented. If a function takes a parameter x and somewhere calls x.sum, then the inferred type of a is anything that implements sum. Sure you can define a type by name, but it's really just an alias for the interface the individual members must implement. It seems like you'd get all the benefits of compile time type checking, while still being able to write code as if it were a dynamic typed language.

I'm sure any actual implementation would be a horror in its own way, but from here it seems like a good idea.

That's how C++ templates work. The requirements of template parameters are essentially determined by the code that uses them.

Biggest downsides are that interfaces are fragile, since they're implicit to the implementation, and aren't documented inherently by declarations. Also, error messages tend to suck, since they actual error is inside the template, not the user, although I suppose the kind of analysis you're talking about could help.

Sedro
Dec 31, 2008

Absurd Alhazred posted:

Structural typing seems to be what you're describing. It's used by OCaml, Go, and you can also do this with templates in C++, actually.

Also Typescript. It's becoming a powerful language with features like mapped types

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

TooMuchAbstraction posted:

What you're missing here is how many SWEs at Google are screaming for Go to get generics.

i never said rob pike's dumbass idea was actually correct

return0
Apr 11, 2007

Absurd Alhazred posted:

Structural typing seems to be what you're describing. It's used by OCaml, Go, and you can also do this with templates in C++, actually.

Yeah Scala has this too.

canis minor
May 4, 2011

So I registered my Dell computer:

NtotheTC
Dec 31, 2007


canis minor posted:

So I registered my Dell computer:



I'll never understand how this happens, what do you have to do to a web/email app that turns off template rendering, and is subtle enough that you can do it accidently?

Whatever the answer I'm sure it boils down to PHP.

boo_radley
Dec 30, 2005

Politeness costs nothing
I'll bet someone flubbed the name of a token file somewhere.

Making the rounds in my part of Twitter today:

Meat Beat Agent
Aug 5, 2007

felonious assault with a sproinging boner
The only horror in that image is the glaring copy-paste error

Pollyanna
Mar 5, 2005

Milk's on them.


Meat Beat Agent posted:

The only horror in that image is the glaring copy-paste error

I'm gonna need line numbers for this one, cause I really don't wanna look at that more than I have to.

Nth Doctor
Sep 7, 2010

Darkrai used Dream Eater!
It's super effective!


Meat Beat Agent posted:

The only horror in that image is the glaring copy-paste error

Cherries and watermelons are both berries, so it's close enough for me.
Probably some customer requirement.

E: TIL cherries are not considered berries.

Nth Doctor fucked around with this message at 16:12 on Jul 5, 2017

Neco
Mar 13, 2005

listen

Pollyanna posted:

I'm gonna need line numbers for this one, cause I really don't wanna look at that more than I have to.

31

boo_radley
Dec 30, 2005

Politeness costs nothing

Nth Doctor posted:

Cherries and watermelons are both berries, so it's close enough for me.
Probably some customer requirement.

Quick, what's the emoji for legacy code?

Eela6
May 25, 2007
Shredded Hen

boo_radley posted:

Quick, what's the emoji for legacy code?

🤔

Pollyanna
Mar 5, 2005

Milk's on them.


boo_radley posted:

Quick, what's the emoji for legacy code?

:shepicide:

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



boo_radley posted:

Quick, what's the emoji for legacy code?

💩🔥

CPColin
Sep 9, 2003

Big ol' smile.

boo_radley posted:

Quick, what's the emoji for legacy code?



Or "NO-BREAK SPACE"

nielsm
Jun 1, 2009



boo_radley posted:

Quick, what's the emoji for legacy code?

J

<font name=Wingdings>J</font>

nielsm fucked around with this message at 18:25 on Jul 5, 2017

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


The most fun unicode characters for code identifiers or slack handles are definitely the various space characters.

Soricidus
Oct 21, 2010
freedom-hating statist shill

<g>

Steve French
Sep 8, 2003

NtotheTC posted:

I'll never understand how this happens, what do you have to do to a web/email app that turns off template rendering, and is subtle enough that you can do it accidently?

Whatever the answer I'm sure it boils down to PHP.

Perhaps similar: it may be something about the way it is configured, but the I18n library we use just spits back out the translation key if it isn't found, rather than the desired translation.

Jewel
May 2, 2009

The fun thing is reading that code and seeing how stupid it actually is. It checks if FuncThatAlwaysReturnsFalse() == false and prints a poop emoji if so. Then it makes a vector of shared pointers to a bunch of virtual structs which print their corresponding emoji in a loop; and finally it returns.. std::rand()? As the output of main? Sure. Fine.

Also let's not forget the monkey emoji enum that's defined and never used. Bad code, would not pass review, 0/10

Jewel fucked around with this message at 17:33 on Jul 5, 2017

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

boo_radley posted:

Quick, what's the emoji for legacy code?

🕴

Mikey-San
Nov 3, 2005

I'm Edith Head!

boo_radley posted:

Quick, what's the emoji for legacy code?

U+1F6AE PUT LITTER IN ITS PLACE

VikingofRock
Aug 24, 2008




boo_radley posted:

Quick, what's the emoji for legacy code?

U+1F92E FACE WITH OPEN MOUTH VOMITING.

ullerrm
Dec 31, 2012

Oh, the network slogan is true -- "watch FOX and be damned for all eternity!"

Zemyla posted:

I thought it trended towards "ease of use for lowest common denominator programmers"?

It's actually even worse than that -- it's "programmers are uniformly stupid and will blown their own arm off given the chance, so let's make a language even more stupid as the programmers that makes it hard as possible to blow off their arms." For example: If you iterate over the keys in a map, what order do they come in? In most languages, it's either "ordered ascending" (because the map is backed by a red-black tree) or "implementation-defined" which means unknown but consistent (because the map is backed by a hash table).

In Go? It's randomized at runtime. The standard implementation of Go's map is a hash table, but it picks a random index at in the bucket list as the start point for iterating over the keys, so that not only is it implementation-defined, it's unpredictable. They did this by design because they figured it'd be impossible for programmers to notice and depend on an implementation-defined key ordering, if there was none.

At times, Go feels like Google's last resort because they couldn't convince college grads to program in a nice safe harmless language like LOGO.

ullerrm fucked around with this message at 18:36 on Jul 6, 2017

fritz
Jul 26, 2003

ullerrm posted:

For example: If you iterate over the keys in a map, what order do they come in?

GALLANT:

quote:

"ordered ascending" (because the map is backed by a red-black tree)

GOOFUS:

quote:

In Go? It's randomized at runtime. The standard implementation of Go's map is a hash table, but it picks a random index at in the bucket list as the start point for iterating over the keys, so that not only is it implementation-defined, it's unpredictable. They did this by design because they figured it'd be impossible for programmers to notice and depend on an implementation-defined key ordering, if there was none.

Stormgale
Feb 27, 2010

Not sure if this is the right place, but at my new job (A Mix of Uniface and SQL coding for a University) they have no version control enabled beyond segmenting deploy scripts and deployed code by task in a file structure.

I am in a team of 4, of about 5 teams.

I think I know what my primary task for the next until it's implemented is.

They use a shared Uniface development project so Uniface Version control is going to have to be done via exporting as XML and Versioning that for re-import into the development environment for rollbacks etc.

Adbot
ADBOT LOVES YOU

CPColin
Sep 9, 2003

Big ol' smile.
The map iteration order thing happened with the home-spun CMS at my last job. The original architect came up with the noble goal that components shouldn't communicate with each other and especially shouldn't assume other components on the page had already loaded their data. Fine. His way to enforce this was by putting the components in a hashtable and initializing them in the semi-random iteration order.

Of course, if the hash codes are stable (they were constants), the iteration will happen in the same order every time, until somebody added a new component to the page and everything potentially hashed into different buckets. This obviously led to issues where a page would work fine, because everything had initialized in just the right order, then Creative would make a change and the house of cards would collapse.

The fancy new solution was to have "early" components that would process first. Fine. This worked until one of them tried to rely on another's processing. (Well, it worked beyond that time for a while, until a new "early" component made everything hash into different buckets.)

So now the solution was to have "logic" components, which never displayed anything on the page and only ever loaded and processed data. They did their work before the "early" components. Naturally, those started depending on each other, too! Also, the other components now had to declare which logic components they needed, or the functionality would be missing. (Unless a different component on the same page initialized the logic component, of course!)

My solution was to have a static class with a lazy getInstance() function and make the classes as small as I could get them. I've been gone from that job for six months and I wonder how their code is doing!

CPColin fucked around with this message at 20:40 on Jul 6, 2017

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