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
JawnV6
Jul 4, 2004

So hot ...

gonadic io posted:

honestly all I want out of a language is
- pattern matching,
- a type system with generics and decent type classes,
- lambdas,
- locals are immutable my default
- maybe not a GIL

i don’t understand any of these

unless ‘pattern matching’ is regex but that sounds like a dumb subset

Adbot
ADBOT LOVES YOU

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

JawnV6 posted:

i don’t understand any of these

unless ‘pattern matching’ is regex but that sounds like a dumb subset

pattern matching allows you to specify different function definitions for certain specific values of parameters

from learnyousomeerlang:
code:
quicksort([]) -> [];
quicksort([Pivot|Rest]) ->
    {Smaller, Larger} = partition(Pivot, Rest, [], []),
    quicksort(Smaller) ++ [Pivot] ++ quicksort(Larger).
    
partition(_, [], Smaller, Larger) -> {Smaller, Larger};
partition(Pivot, [H|T], Smaller, Larger) ->
    if H =< Pivot -> partition(Pivot, T, [H|Smaller], Larger);
        H > Pivot -> partition(Pivot, T, Smaller, [H|Larger])
    end.
here the overall function for quick sort takes a list but you can pattern match on the special case of an empty list being passed in to just return an empty list

am i getting terms mixed? \/\/\/

FamDav
Mar 29, 2008

JawnV6 posted:

i don’t understand any of these

unless ‘pattern matching’ is regex but that sounds like a dumb subset

- pattern matching: this goes hand in hand with union types/algebraic data types. you can write something like this in rust (I haven't written it in awhile so this is def wrong)

code:
enum Thing {
  PoopThing(poop: String),
  FartThing(fart: int32)
}

void doAThing(something: Thing) {
  match (something) {
    PoopThing(poopString): /* something */
    FartThing(fartInt): /* some other thing */
  }
}
which makes dynamic dispatch a lot nicer compared to the visitor pattern.

- a type system with generics and decent type classes: generics/templates are like, generics and templates. have you never used java or c++? type classes are more or less generic interfaces from java, and generally have the ability to implement typeclasses over other generic types (ex. I implement the type class Queryable for all things Readable and Writable)

- lambdas: anoymous functions. again, have you never used c++11 or java 8?

- locals are immutable by default: const is the default and you should have to explicitly override it

- maybe not a GIL: maybe don't have a single process-level lock that all threads have to take to do much of anything

EDIT: another way to think of typeclasses are that they are dispatch tables that you can define within the language and that the compiler will inline for you

FamDav fucked around with this message at 18:50 on Nov 27, 2017

Shaggar
Apr 26, 2006

Fiedler posted:

No, one should learn C only reluctantly and after carefully eliminating all reasonable alternatives.

Workaday Wizard
Oct 23, 2009

by Pragmatica
i love pattern matching
code:
match something() {
	Who(_, _, Loves(_, _, _, Nesting(x, y, _, I(Do), I(Do)))) => yay(), // YES!!! got my special case happy path
	_ => doesnt_match_my_special_case(fuck_you),
}

Shaggar
Apr 26, 2006

JawnV6 posted:

i don’t understand any of these

unless ‘pattern matching’ is regex but that sounds like a dumb subset

pattern matching is switch statements but more complex case statements.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

ultravoices posted:

think python was more dry and obviously keyed for a college level course for kids who had a recent math background. my old rear end had to do some heavy googling to know what an ackermann function was and why I wanted to implement it to make it through the examples.

oh man I learned with think python, it was so fitting for my autistic math obsessions

but I know it's not for everyone, just saying that I particularly loved the book :shobon:

Carthag Tuek
Oct 15, 2005

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



re: type classes

whats the difference from protocol extensions swift?

gonadic io
Feb 16, 2011

>>=

NihilCredo posted:


so once you discard scala and rust i guess you're left holding the short end of the io monad?

And I've done a lot of haskell and am not interested in really doing any more. In conclusion: all programming languages are poo poo

But regardless typeclasses I don't need them specifically, I'm happy with anything that serves the same purpose like interfaces, traits, etc etc

gonadic io
Feb 16, 2011

>>=
But yes there's a reason that my chosen programming languages are rust and scala, and haskell I have the most experience in

Starting a business id choose c# and f# though, or maybe kotlin. Those jvm or dotnet communities and tooling are just too good

E: kotlin is too niche still, c# and f# are good to hire in

gonadic io fucked around with this message at 19:47 on Nov 27, 2017

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
rjmccall explain this fucker please

https://twitter.com/pepper_chico/status/935192195329593344

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

youre not authorized to view these tweets

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
im not even logged in on twitter and i can see it so


Francisco Lopes‏
@pepper_chico
Follow Follow @pepper_chico
More
So this is modern C++, four compilers, four different interpretations of the standard (and potentially wrong ones):

- https://godbolt.org/g/3s9Lkp

#cpp #cplusplus #cpp11 #moderncpp
9:02 AM - 27 Nov 2017

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
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

clang is correct to complain about D2 and F2, those variables are captured by copy and so the fact that they were originally references is irrelevant: this is a non-mutating lambda and so a reference to the capture is a const l-value

gcc's problem with B1 is definitely wrong, decltype is an unevaluated context regardless of whether the argument expression is the special form, and variables used in unevaluated contexts don't need to be captured

icc's problem with B2 is wrong, that does need to be const int &

msvc is lol

cinci zoo sniper
Mar 15, 2013




gonadic io posted:

But yes there's a reason that my chosen programming languages are rust and scala, and haskell I have the most experience in

Starting a business id choose c# and f# though, or maybe kotlin. Those jvm or dotnet communities and tooling are just too good

E: kotlin is too niche still, c# and f# are good to hire in

how is f# not niche

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

how is f# not niche

You'd be surprised, especially in London. More importantly, c# and f# can call each other trivially so some components can be built in one and some in another

Cybernetic Vermin
Apr 18, 2005

cinci zoo sniper posted:

how is f# not niche

depends very much on ones views, but being created and backed pretty heavily by microsoft (including tool support) does lend it a certain legitimacy. when compared to kotlin it may be good to note that f# has been around longer and the effort to keep tracking the .net platform changes in a sensible way has been demonstrated

kotlin seems entirely fine though, targetting the jvm is good for not needing to worry about the future too much. worst case, where jetbrains drops the ball on it in some way, you just get frozen on a compiler, but the runtime will continue to live and be worked on, and you can in that case piecewise migrate onto java or some other jvm language


good to switch to this subject matter, because the c++ post above just scares me deeply

cinci zoo sniper
Mar 15, 2013




gonadic io posted:

You'd be surprised, especially in London. More importantly, c# and f# can call each other trivially so some components can be built in one and some in another

Cybernetic Vermin posted:

depends very much on ones views, but being created and backed pretty heavily by microsoft (including tool support) does lend it a certain legitimacy. when compared to kotlin it may be good to note that f# has been around longer and the effort to keep tracking the .net platform changes in a sensible way has been demonstrated

kotlin seems entirely fine though, targetting the jvm is good for not needing to worry about the future too much. worst case, where jetbrains drops the ball on it in some way, you just get frozen on a compiler, but the runtime will continue to live and be worked on, and you can in that case piecewise migrate onto java or some other jvm language


good to switch to this subject matter, because the c++ post above just scares me deeply

fair enough, its probably just me living in the loonies that i hadn't heard of f# until this year

cinci zoo sniper
Mar 15, 2013




waaaait. i just went to read about f# and you can do some flavour of static typing with it? and i mean in general, do python/r style coding but with actually guaranteed outcomes and poo poo?

hoooly gently caress :eyepop:

e: https://fsharpforfunandprofit.com/posts/correctness-type-checking/ :fap: i know what ill be doing next year, this looks really loving good. maybe more c# than this per se since i have enough of what i assume to be functional programming at work already, but why not

cinci zoo sniper fucked around with this message at 20:59 on Nov 27, 2017

cinci zoo sniper
Mar 15, 2013




random musings (i think i asked this before, probably even itt) - what are the bad things about haskell?

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

cinci zoo sniper posted:

random musings (i think i asked this before, probably even itt) - what are the bad things about haskell?

haskell fans

cinci zoo sniper
Mar 15, 2013




carry on then posted:

haskell fans

i thought that was rust

quote:

Exploring different microcontrollers less than $1
November 05, 2017 (comments)
An Internet surveys a sampling of lovely hardware. The website falls over. Hackernews bitches about the quality of Google search results, then proceeds to rattle off whatever comparably-lovely hardware they're familiar with, regardless of whether it has anything to do with the testing performed by the author. The Rust Evanglism Strike Force arrives to reassure everyone that their lovely programming language works great on lovely hardware, as long as you use one of a very few cared-about platforms.

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

FamDav posted:

youre old

remember when java had synchronized collections by default

a witch
Jan 12, 2017

Malcolm XML posted:

remember when java had synchronized collections by default

Vectors and StringBuffers still haunt a lot of codebases :(

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

random musings (i think i asked this before, probably even itt) - what are the bad things about haskell?
ramble post ahead
bad as a language, bad for people to learn, or bad to use in production?
one thing that's always annoyed me is its standard library string type is academic and only for demos. should never ever be used in any code intended to be executed.

typeclasses are pretty awkward in practice and (much like nightly rust) it's extremely difficult to avoid using a half-dozen or so compiler extensions to manage them

its time and memory usage are wildly unpredictable and difficult to optimise. when optimised it's fine though but laziness was an interesting idea but everything being lazy by default is a bad idea and much of optimising haskell is removing as much laziness out of your small values as possible. for example, foldl has the worst properties of both laziness and strictness so shouldn't even exist in favour of foldl'. foldr tends to cause space leaks

i still like it a lot as a language, i wish more languages actually curried. (don't talk to me about scala's attempt)

as simon p jones said in his oft misquoted talk "haskell is useless", its ideas are appearing in essentially every programming language these days (for better or for worse) and haskell exists to prove that the concepts are viable.

things like lenses, stm, side effecting types were all popularised by haskell (afaik). other good things that were not invented by haskell but are also being included everywhere are adts, first class functions, currying

and none of this mentions the lack of infrastructure compared to the incredible .net or jvm platforms

Sapozhnik
Jan 2, 2005

Nap Ghost
i'd be a lot more hyped for f# if it wasn't shackled to the .net ecosystem because it is just so goddamn bad

gonadic io
Feb 16, 2011

>>=
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

gonadic io fucked around with this message at 21:41 on Nov 27, 2017

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
ok, so it turns out that, two releases after introducing lambdas, the c++ committee might have just changed its mind about how captures interact with decltype, so that all three of B2, D2, and F2 should be 'int &'

this is not a bugfix, it is them removing an intentionally-added special case and changing behavior

but i don't know if that's supposed to be in c++17 or not

Workaday Wizard
Oct 23, 2009

by Pragmatica
haskell is this sketch in programming language form
https://www.youtube.com/watch?v=KrJYpActs7g&t=10s

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
okay, actually, they just moved the wording to a more sensible part of the standard and clarified things accordingly, so everything's good

CLASS 2 PERVERSION
Jan 19, 2010
re: haskell, i think the worst bit is the type-signatures-are-all-the-documentation-you-need nature of some of the ecosystem. that and everyone inventing their own operators. apart from that it is my favorite spare time hobby langauge. in some ways it feels more like playing with lego than programming. it's super fun.

CLASS 2 PERVERSION
Jan 19, 2010
and the standard string type, yeah it's completely impractical for use, but haskell was the first language I learned after C and strings just being lists of of chars seemed like a super awesome idea then

gonadic io
Feb 16, 2011

>>=

a very small horse posted:

and the standard string type, yeah it's completely impractical for use, but haskell was the first language I learned after C and strings just being lists of of chars seemed like a super awesome idea then

i'd say the main compaint i have about actually programming in haskell now is that the way that the language is used has vastly changed beyond what the designers of the haskell98 language, tools, etc etc imagined. this is both a good and bad thing.

NihilCredo
Jun 6, 2011

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

Sapozhnik posted:

i'd be a lot more hyped for f# if it wasn't shackled to the .net ecosystem because it is just so goddamn bad

i follow p closely and occasionally contribute to f# tooling. i've noticed that the core group of contributors, including the bdfl don syme, are all really enthusiastic about fable (the third and most recent f#-to-js compiler), to the point that new language features are being weighted against whether they will support better js compilation and integration with platforms like react native

imo it's clearly a long-term move to give f# a foothold / escape hatch separate from the .net world, most likely since the recent shakeups in the latter (the roslyn compiler rewrite, .net core) were all done with ms violently ignoring anything except their core "c# and asp.net mvc with entity framework on azure" business target, to the point that visual studio 2017 originally shipped with completely broken f# support

also between elm, wasm and facebook's weird reasonml thing there seems to be a growing interest in non-poo poo-language-to-js compilers, and on that field the f#/fable stack is pretty well positioned b/c of code reuse between frontend and backend and also its ability to consume typescript definitions to get typed bindings to a lot of the js ecosystem for free

CLASS 2 PERVERSION
Jan 19, 2010

gonadic io posted:

i'd say the main compaint i have about actually programming in haskell now is that the way that the language is used has vastly changed beyond what the designers of the haskell98 language, tools, etc etc imagined. this is both a good and bad thing.

i think this is kind of cool now though. I would not claim to be an expert but more modern haskell feels a bit more like a big boy langauge.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

NihilCredo posted:

also between elm, wasm and facebook's weird reasonml thing there seems to be a growing interest in non-poo poo-language-to-js compilers,

this makes me wonder if people consider TypeScript to be a not-poo poo language, or just the least lovely option

DELETE CASCADE
Oct 25, 2017

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

Fiedler posted:

What language are you talking about? From context I'm guessing C#, but if so the "fucks up the execution" part doesn't make sense.

it does though, because windows

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Thermopyle posted:

this makes me wonder if people consider TypeScript to be a not-poo poo language, or just the least lovely option

I fukken hated typescript but that was probably because of the hosed ecosystem I was in.

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
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

Adbot
ADBOT LOVES YOU

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?

Sapozhnik posted:

remember when java originally had green threads lol

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

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