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
redleader
Aug 18, 2005

Engage according to operational parameters
how do people actually learn c++ in tyool 2017, and how on earth can they have any confidence that the code they wrote is correct? it seems like such a minefield of weird minutiae that also has odd edge cases that can shoot your leg off

NihilCredo posted:

the f#/fable stack is pretty well positioned b/c of code reuse between frontend and backend

[screaming internally]

Adbot
ADBOT LOVES YOU

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
nobody learns all of c++, there is just too much of it to know everything. each new feature you start using in your code provides more cost than benefit, because it will have unforeseen bad interactions with other features, due to reasons that could only ever apply to c++. therefore, the strategy is to select a minimal subset of c++ which suits your problem space, and stick to it rigidly, with a coding style guide that has been very carefully thought out by senior developers. this will make it manageable to work in. of course, when you leave that company and join another, they will have chosen a different subset, and you get to learn the language you supposedly knew all over again! sounds great huh

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
also i'd like to add a double gently caress-you for linking me to that thread, i tried to talk to that dude just to let him know what was up and it was a huge, frustrating waste of time

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

redleader posted:

[screaming internally]

why, do you enjoy writing every input validation rule twice?

VikingofRock
Aug 24, 2008




rjmccall posted:

decltype is dumb, lambda captures are dumb, go gently caress yourself

alright, so first, decltype(x) is supposed to have different semantics from decltype((x)), because the first is a special form that produces the actual declared type of the variable/member, and the second is the expression type decorated by & if an l-value and && if an x-value. decltype(x) inside a lambda is still based on the actual declaration of the local variable, ignoring the fact that it's been captured, but decltype((x)) is treated as if x were a reference to the lambda capture field, even if there is not in fact a lambda capture because x is never captured

Wow, all this behavior is completely surprising to me. I would have guessed that decltype(x) and decltype((x)) were exactly the same, and that decltype(x) would only work if x was in scope (and thus wouldn't work at all if x was not captured).

Although I suppose if there are two things I've learned in C++, it's (1) expect the unexpected, and (2)

rjmccall posted:

msvc is lol

Suspicious Dish
Sep 24, 2011

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

rjmccall posted:

also i'd like to add a double gently caress-you for linking me to that thread, i tried to talk to that dude just to let him know what was up and it was a huge, frustrating waste of time

you're very welcome

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

gonadic io posted:

the good parts of scala are just a more modern java. it suffers from the yoke of jvm compatibility, but java 8's attempt to takc some crapt onto an ancient language are horrible and (the good parts of scala) solve that problem by reducing boilerplate, having immutable-by-default functions, better support for map/filter/fold, laziness, etc etc. this is what i'm hoping for from kotlin, i've not actually ever used it.

it's similar to f#. but that is less necessary for c# because c# seems to have done a better job keeping itself up to date with linq etc.

unfortunately scala, like c++, is approximately 4 languages at once and without strict code review and guidelines you code will quickly become a mess. the java programmer can happily write java with some sugar, the ruby programmer is message passing between weakly typed objects using lots of underscores which are positional arguments, and the haskell programmer is busy fart huffing with 3 nested type params and type-wildcard underscores which have COMPLETELY DIFFERENT meaning to the ruby dev's underscores

i agree with all your points but i really find scala super pleasurable to program in. really really enjoying it lately. programming with typeclasses is very nice although I wish it were more of a first class concept (I suppose you could argue that context bounds make them a first class feature but the implementation by way of implicits is awkward and took me a while to understand).

i just loving love type systems. whenever I go back to a dynamic language I get really frustrated.

DONT THREAD ON ME fucked around with this message at 03:44 on Nov 28, 2017

Fiedler
Jun 29, 2002

I, for one, welcome our new mouse overlords.

MALE SHOEGAZE posted:

i just loving love type systems. whenever I go back to a dynamic language I get really frustrated.

As is right and proper.

cinci zoo sniper
Mar 15, 2013




gonadic io posted:

tl;dr
haskell has some very good ideas that are really useful
it's okay as a language but it's standard library is awful
lots of fart-huffing going on
in 300 years maybe you'll be able to deploy and test and recruit as well as you can for c#

so i recommend learning and building a hobby project in. this thread has plenty of people able and happy to help. then when you've huffed straight farts you'll find you recognise and can apply those smells in other projects that are easier to deploy and have existing libraries

cheers

Sapozhnik
Jan 2, 2005

Nap Ghost

DELETE CASCADE posted:

the problem with non-poo poo-language-to-js compilers is not technical but social. such compilers have existed for years, but there's still a critical mass of javascript developers in webshit land. new developers could learn the goodlang instead, but they don't, they learn javascript, because it's the lingua franca of webdev, and they can get a job doing it, and sure they'll hate their miserable lives, but if they didn't want to feel that way 24/7 they wouldn't be doing frontend. that's why people like typescript, because you can gradually start to write js with the occasional var:type and suddenly half your bugs are gone and you didn't have to hire a new team or waste time retraining

a lot of dumb javascript poo poo is just not amenable to typescript's or flow's type system. the compile-time guarantees just aren't there. and after compile time static type system is a distant memory, kind of by definition really.

i mean it's still better than nothing but it drives me up the wall when i occasionally try to do something obviously nonsensical and the type checker just smiles and nods because hey guess what the inferred type of half your poo poo ended up being "any"

gonadic io
Feb 16, 2011

>>=

MALE SHOEGAZE posted:


i just loving love type systems. whenever I go back to a dynamic language I get really frustrated.

Absolutely same. I work in Scala, and don't hate doing so.

Have you done much in f# or rust or haskell or ocaml? It's always nice to get some context/comparisons

cinci zoo sniper
Mar 15, 2013




i like the idea of static-esque type systems, but i dont think ive worked in anything with them. i dont remember what type system pascal had, and i barely remember anything from delphi or that after-hours c++ class i took in 8th grade

redleader
Aug 18, 2005

Engage according to operational parameters
they are good and easy and often intuitive

cinci zoo sniper
Mar 15, 2013




redleader posted:

they are good and easy and often intuitive

i just really like the idea of computer yelling "bad mushroom" when i try to change encoding of a floating point number to utf-8 or something :shobon:

cinci zoo sniper
Mar 15, 2013




not that python doesn't do that being *sweating* strongly typed, for instance, but input validation and poo poo is a chore that should be just circumvented with whatever f# does where you make a 5 line custom class that is a natural number or whatever

cinci zoo sniper
Mar 15, 2013




forcing ints to be such is also cool

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?
Objective-C really does hit a sweet spot when it comes to explicit types and dynamic dispatch:

  • only objects get dynamic dispatch, C primitive types stay exactly the same and can be used to interoperate with OO code
  • an object referenced via a variable declared id can be sent any message at all, though the compiler can warn for messages that don’t have any declarations at all
  • an object referenced via a variable declared as being a specific class or protocol can only be sent messages appropriate for that class or protocol, though the compiler takes a flag that reduces this from an error to a warning
  • ”categories” let you add methods to classes you don’t control at compile time, making it possible to add new cross-cutting behavior very easily and without complicated metaprogramming (e.g. you can add a method to NSString that returns a reversed string, and it’ll work for any instance of NSString and any subclasses)—this is where C# got the idea for extension methods, but ObjC has nicer syntax for declaring them
  • complicated metaprogramming is possible because the entire runtime is dynamic (with the exception that classes can’t really be safely removed or unloaded, because caches can get built up based on class identity), so you can do things like add methods to classes at runtime that
  • memory management has been largely automated in a way that most developers don’t need to worry about much, and in a way that’s a lot easier for developers to reason about than something like Rust’s borrow checker
  • closures (blocks) are supported, and you can even add a method at runtime whose implementation is a closure, the only downside is that closure syntax is basically C function pointer syntax
  • type-erasing generics were added recently, and provide a useful degree of API annotation for homogeneous collections, without imposing all sorts of complicated semantics on the API and without affecting the ABI

sure Swift has all sorts of things like “real” generics, algebraic data types, a choice between static and dynamic dispatch, and much, much stricter typing, but almost all of the above was supported in ObjC 10 years ago and most of it was supported 20+ years ago

Soricidus
Oct 21, 2010
freedom-hating statist shill

cinci zoo sniper posted:

not that python doesn't do that being *sweating* strongly typed, for instance

it’s nicer when the computer yells at you the moment you type the wrong code, instead of waiting till it’s three hours into a complicated computation, probably in prod because you wrote the wrong tests

pycharm does pretty well these days with what it’s got but static analysis of dynamically typed code is always going to have limitations

cinci zoo sniper
Mar 15, 2013




Soricidus posted:

it’s nicer when the computer yells at you the moment you type the wrong code, instead of waiting till it’s three hours into a complicated computation, probably in prod because you wrote the wrong tests

pycharm does pretty well these days with what it’s got but static analysis of dynamically typed code is always going to have limitations

yeah i use pycharm. thankfully so far my things break early into tests, and i dont maintain or develop any prod solutions (yet)

Cybernetic Vermin
Apr 18, 2005

even more important as codebases grow and code ages the lack of type information tends to make interfaces and abstractions, the code in general really, inscrutable

it can be hard enough to make sufficient sense of an old java codebase to be able to fix it or add some functionality to it, and java tends to be a best-case (the type system is not the strongest, but the conventions are so well established that you seldom run into something truly weird). in e.g. python it can quickly turn impossible

feedmegin
Jul 30, 2008

eschaton posted:

Pepperidge Farms remembers

this was only on systems that didn’t have native threads right, because Solaris had them by the mid-1990s, as did many other Unixes (they just didn’t all have the pthreads API on top yet)

hell the classic Mac OS even had native threads back then, both cooperative (Thread Manager on 68K & PPC) and preemptive (Multiprocessing Services and PPC)

green threads as a concept should’ve been dead by 1995 or so

Green threads are cooperative threads effectively, I'm not sure what using MacOS's version of those instead would have brought to the table.

Early Java on Solaris used green threads, too. If you want to have lots and lots of threads, they're a lot more lightweight than native threads, especially Solaris' back then, and if you don't have multiple CPUs/cores native threads aren't actually buying you that much. Also, can be easier to implement (on the one hand you gotta use async I/o everywhere, on the other your JVM/runtime/native code doesn't have to be native-threadsafe)

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?

feedmegin posted:

Green threads are cooperative threads effectively, I'm not sure what using MacOS's version of those instead would have brought to the table.

Early Java on Solaris used green threads, too. If you want to have lots and lots of threads, they're a lot more lightweight than native threads, especially Solaris' back then, and if you don't have multiple CPUs/cores native threads aren't actually buying you that much. Also, can be easier to implement (on the one hand you gotta use async I/o everywhere, on the other your JVM/runtime/native code doesn't have to be native-threadsafe)

“green threads” means a user space rather than OS threads implementation

it doesn’t necessarily mean cooperative, though most implementations are because LOL at implementing context switching with signal and setjmp/longjmp

Workaday Wizard
Oct 23, 2009

by Pragmatica
what makes them green anyways? :confused:

Cybernetic Vermin
Apr 18, 2005

Shinku ABOOKEN posted:

what makes them green anyways? :confused:

a bit surprised to find that it apparently originated with the jvm, the original java team being known as the "green team". i thought for sure the term was older than that, user-space thread implementations after all are, but the java library name stuck

JawnV6
Jul 4, 2004

So hot ...

eschaton posted:

it doesn’t necessarily mean cooperative, though most implementations are because LOL at implementing context switching with signal and setjmp/longjmp

LOL indeed

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
one thing that bothers me about swift is that when you install it on ubuntu you need to install python-dev for it to run but the docs doesn't say it https://swift.org/download/#linux

yes I'm pedantic yospos birch

Xarn
Jun 26, 2015

cinci zoo sniper posted:

i just really like the idea of computer yelling "bad mushroom" when i try to change encoding of a floating point number to utf-8 or something :shobon:

:same: except maybe not mushroom :v:

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

Sapozhnik posted:

a lot of dumb javascript poo poo is just not amenable to typescript's or flow's type system. the compile-time guarantees just aren't there. and after compile time static type system is a distant memory, kind of by definition really.

i mean it's still better than nothing but it drives me up the wall when i occasionally try to do something obviously nonsensical and the type checker just smiles and nods because hey guess what the inferred type of half your poo poo ended up being "any"

you are correct, and the best solution is to let really smart people like anders keep making the type system even more powerful, so it can represent those patterns :getin:

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?

Symbolic Butt posted:

one thing that bothers me about swift is that when you install it on ubuntu you need to install python-dev for it to run but the docs doesn't say it https://swift.org/download/#linux

yes I'm pedantic yospos birch

file a Radarpublic and searchable bug report yet?

Sapozhnik
Jan 2, 2005

Nap Ghost

DELETE CASCADE posted:

you are correct, and the best solution is to let really smart people like anders keep making the type system even more powerful, so it can represent those patterns :getin:

eh maybe. i know nothing about plt

something that comes up a lot is a table of handlers for various kinds of event, where events are things that have a string field called "type". in plain vanilla hurf durf javascript you just write something like eventHandlers[eventType] = handlerFn; and then you dispatch to a handler by writing something like eventHandlers[event.type](event);

you cannot statically type that second expression; there is no way to express the necessary invariants using any js type checker's type system.

alternatively, consider something like redux-saga. you do your background io in a generator. which is a coroutine that gets periodically resumed by the redux-saga runtime, and said coroutine yields various io effect objects back to the runtime telling it to do various asynchronous io things, then resume the coroutine with their results when they are complete. this is pretty cute because you can test it easily: instead of faking all the stuff that your async io code wants to talk to you just run the coroutine and check that it generates a stream of the correct actions, feeding it sensible consequences of those actions in your test fixture.

but you can't type that either: for a given effect type E the run time is going to yield back some result type R. how do you assert that correspondence to the type system and make it enforce that upon the implementation of the runtime?

this sort of thing already makes my head hurt but this is probably the point where haskell people come out and go "you are like a little baby, watch this"

Aramoro
Jun 1, 2012




a witch posted:

Vectors and StringBuffers still haunt a lot of codebases :(

The code base I currently work in uses Vectors in it's Struts 1.3 view layer. This is the view for an Stateless EJB 3.0 layer so :iiam:

Luckily that view is getting binned in favour of a REST driven front end.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





i feel like i'm programming with my toes when i'm forced to use a lang that doesn't have pattern matching. it's so good

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

the talent deficit posted:

i feel like i'm programming with my toes when i'm forced to use a lang that doesn't have pattern matching. it's so good

i like that expression and ya.

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?
perrible toegrammer thread

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

eschaton posted:

perrible toegrammer thread

yes please the current name blows

VikingofRock
Aug 24, 2008




YOSPOS > terrible programmers: toegrammer parables

mystes
May 31, 2006

YOSPOS: Which thread is the terrible programmer thread? You decide! They're all the terrible programmer thread

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
toejam and perl

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



MALE SHOEGAZE posted:

toejam and perl

Adbot
ADBOT LOVES YOU

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

Sapozhnik posted:

eh maybe. i know nothing about plt

something that comes up a lot is a table of handlers for various kinds of event, where events are things that have a string field called "type". in plain vanilla hurf durf javascript you just write something like eventHandlers[eventType] = handlerFn; and then you dispatch to a handler by writing something like eventHandlers[event.type](event);

you cannot statically type that second expression; there is no way to express the necessary invariants using any js type checker's type system.

maybe not currently, but it sounds like a basic sum type (tagged union), where instead of a string field you enumerate the event types

Sapozhnik posted:

alternatively, consider something like redux-saga.

i will not

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