|
Plorkyeran posted:it looks like a pretty straightforward design that isn't very powerful but good enough for a lot of use cases. pretty much exactly what you would expect go generics to be. yeah, exactly
|
# ? Jun 19, 2020 13:17 |
|
|
# ? Jun 6, 2024 09:33 |
|
it feels like they implemented Canadian Aboriginal Syllabics generics natively. especially since you apparently have to specify the types every time you call a generic method.
|
# ? Jun 19, 2020 13:37 |
|
M31 posted:it feels like they implemented Canadian Aboriginal Syllabics generics natively. especially since you apparently have to specify the types every time you call a generic method. good lord. generics without type inference is almost worse than not having generics
|
# ? Jun 19, 2020 13:41 |
|
NihilCredo posted:
tbf, from reading the proposal, this is just a compromise to allow you to use compiler-magic generic operators with generic functions. most languages that don't have operator overloading dont even try to solve this problem afaik (C#, Java, F#).
|
# ? Jun 19, 2020 13:46 |
|
MononcQc posted:look you can use the new feature if you type the the pledge of allegiance and swear on a bible at the top of the file, we just don’t think you’re trustworthy yet love the language, but
|
# ? Jun 19, 2020 14:32 |
|
Xarn posted:Doesn't Rust do the same thing as C++ in regards to ABI? That is, it says "use C ABI and gently caress off" for places where you require stable and interoperable binary layout. Not really, there's a spec and everything on Linux. On Windows there is a stable MSVC ABI but the standard library ABI is not stable across compiler versions, but you shouldn't expose standard library types across module boundaries and the C++ standard library is utter loving dogshit anyway. There's also COM which is a cross-vendor ABI for a subset of C++ (and other languages, theoretically). It's an IDL for defining vtables and also a universal base interface that provides reference counting and dynamic casting services. You can use COM to interop between modules compiled with MSVC and GCC, although GCC isn't used for anything serious in Windows land so it's kind of a moot point.
|
# ? Jun 19, 2020 14:59 |
|
urea posted:tbf, from reading the proposal, this is just a compromise to allow you to use compiler-magic generic operators with generic functions. most languages that don't have operator overloading dont even try to solve this problem afaik (C#, Java, F#). they got help from one of the haskell guy to design this lol
|
# ? Jun 19, 2020 15:01 |
|
Xarn posted:Doesn't Rust do the same thing as C++ in regards to ABI? That is, it says "use C ABI and gently caress off" for places where you require stable and interoperable binary layout. I mean, the actual C++ standard doesn't say anything about ABI, but everyone outside Microsoft uses this, suitably modified for different architectures, and has done for about 20 years now. You'll note Qt maintains binary compatibility within major versions quite happily, for example.
|
# ? Jun 19, 2020 15:21 |
|
The only good ABI stories are: - C - Swift - CSV
|
# ? Jun 19, 2020 15:24 |
|
sapozhnik’s right on here, but to be clear, the point is that c++ does have a stable and interoperable abi. it‘s much easier to make a stable interface by making it c-style, but it’s certainly possible to do it in c++, because the c++ abi is stable. so rust does not do things the c++ way, it does its own thing gcc does not implement the msvc c++ abi, so if you’re using gcc for c++ on windows (e.g. in mingw) and want to interoperate with an msvc-compiled c++ library you do need to go through an extern c interface. or you can use clang, which will use the msvc c++ abi when asked c++ having a stable abi was a recent major controversy on the committee
|
# ? Jun 19, 2020 15:34 |
|
Zlodo posted:they got help from one of the haskell guy to design this lol yeah, eddie
|
# ? Jun 19, 2020 15:51 |
|
Phobeste posted:good lord. generics without type inference is almost worse than not having generics the proposal has type inference tho? you only specify types if they’re not visible in the parameters. go bad but let’s not make things up
|
# ? Jun 19, 2020 16:01 |
|
COM and CORBA were good and cool and my friends
|
# ? Jun 19, 2020 16:05 |
|
Com is still around, to the extent that win32 desktop applications are still around. There is even a new and shiny version of com for winrt, which I'm sure people will start using any day now.
|
# ? Jun 19, 2020 16:12 |
|
COM never caught on outside windows to the extent that com/dcom ever existed on unix it was a way for busted-rear end windows applications to call into unix without having to use the native rpc protocols CORBA had real multi-platform support but i think that poo poo is all bitrotten now :\
|
# ? Jun 19, 2020 16:16 |
|
Corba and dcom are another mess altogether. RPC to a particular instance of a stateful object on a particular server somewhere is the single worst idea to come out of the computing industry in the 90s.
|
# ? Jun 19, 2020 16:21 |
|
In theory C++ has a stable API on some systems but in practice on windows you can't mix and match versions of msvcrt or stuff will fall down and break you. If a third party hands you a DLL it needs to be on the same msvcrt as you. gcc/libstdc++ has been stable for a while but until about ten years ago it had no promise to be
|
# ? Jun 19, 2020 16:22 |
|
How in the world did CORBA get greenlit when COBRA is right there?
|
# ? Jun 19, 2020 16:23 |
|
Sapozhnik posted:Corba and dcom are another mess altogether. RPC to a particular instance of a stateful object on a particular server somewhere is the single worst idea to come out of the computing industry in the 90s. It's bad but I don't think modern microservices are any better
|
# ? Jun 19, 2020 16:23 |
|
taqueso posted:How in the world did CORBA get greenlit when COBRA is right there? corba was a weapon of those who wear suits at weekends; the coolest they'd ever get close to was printing out system diagrams indistinguishable from doom maps
|
# ? Jun 19, 2020 16:30 |
|
Microservices are absolutely less bad than distributed objects. Microservices are a solution in search of a problem but they are at least tractable in theory. Distributed objects are an idea shat out in complete ignorance of the most fundamental properties of distributed systems. It is insane by modern standards, but it probably makes sense by the base and animalistic social norms of the day, back when each network service would reside on a single custom-built server and if you needed to serve more users then you would simply order a bigger server.
|
# ? Jun 19, 2020 16:35 |
|
ok yeah sure but explain why smb windows filesharing works more often than my google drive app
|
# ? Jun 19, 2020 16:37 |
|
Sapozhnik posted:Distributed objects are an idea shat out in complete ignorance of the most fundamental properties of distributed systems. It is insane by modern standards, but it probably makes sense by the base and animalistic social norms of the day, back when each network service would reside on a single custom-built server and if you needed to serve more users then you would simply order a bigger server. distributed objects and refcounting are indeed bananas but you have to consider the context, and also, how these things are actually used the context was the land of sun rpc and mach rpc, where the rpc protocol was massively underspecified and every application using the protocols had its own little hand-rolled way of discovering the interface and documenting the correct call pattern dcom and corba made it possible to specify detailed interfaces on how to interoperate with APIs presented over the network, taking the guesswork out of it and making it possible to generate stub clients very rapidly. (i suspect all the object-oriented nonsense was buzzword compliance) one way that real-life dcom or corba applications sometimes worked was that you created one "object" (for your session) and your interactions with the api were on this object and that was that it didn't have to be hell-world
|
# ? Jun 19, 2020 16:41 |
|
Suspicious Dish posted:ok yeah sure but explain why smb windows filesharing works more often than my google drive app yeah smb has always been awesome, particularly for use cases like “I’m the nsa and I want to access that computer”
|
# ? Jun 19, 2020 16:53 |
|
It is kind of neat how SMB workgroups in Windows 95 had a distributed consensus algorithm for service discovery approximately 15 years before it was cool
|
# ? Jun 19, 2020 16:56 |
|
urea posted:tbf, from reading the proposal, this is just a compromise to allow you to use compiler-magic generic operators with generic functions. most languages that don't have operator overloading dont even try to solve this problem afaik (C#, Java, F#). f# does some compile time generic resolution for operators and other inline-ables: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/generics/statically-resolved-type-parameters is that solving the same thing or am i misunderstanding this?
|
# ? Jun 19, 2020 17:54 |
|
Kazinsal posted:https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md lol well it's better than the previous suggestion where you wrote a little interpretive dance of what you wish your type looked like
|
# ? Jun 19, 2020 18:58 |
|
tbqh i could go along with very limited generics, in that 90% of the usecase for generics is to make collections and collections-adjacent code typesafe. what is really dumb about the proposal operates in a duck typing kind of way, where you'd generalize over "addable", i.e. over having an operator named '+', as if there is such a thing as code which ever should generalize over integers, floats and strings.
Cybernetic Vermin fucked around with this message at 19:17 on Jun 19, 2020 |
# ? Jun 19, 2020 19:10 |
|
Cybernetic Vermin posted:tbqh i could go along with very limited generics, in that 90% of the usecase for generics is to make collections and collections-adjacent code typesafe. what is really dumb about the proposal is doing things like generalizing over "addable", i.e. over having an operator named '+', as if there is such a thing as code which ever should generalize over integers, floats and strings. i mean haskell has the Monoid typeclass which is pretty much just Addable with some extra semantics around having associativity and an identity element. haskell is pretty silly though so your point stands
|
# ? Jun 19, 2020 19:21 |
|
animist posted:i mean haskell has the Monoid typeclass which is pretty much just Addable with some extra semantics around having associativity and an identity element. haskell is pretty silly though so your point stands if they went all-in on abstract algebra they'd be in famous company yeah, but that is a moment where i think go's "the programmer is not expected to be very clever" principle actually starts being mostly appropriate. but that's not what they're doing, and their tradeoff is worse. also, of course, haskell does not claim ieee-754 has associative addition. Cybernetic Vermin fucked around with this message at 19:27 on Jun 19, 2020 |
# ? Jun 19, 2020 19:25 |
|
Cybernetic Vermin posted:if they went all-in on abstract algebra they'd be in famous company yeah, but that is a moment where i think go's "the programmer is not expected to be very clever" principle actually starts being mostly appropriate. but that's not what they're doing, and their tradeoff is worse. yeah true. honestly i've never seen much point in haskell's super-abstract type classes. they make sense in, like, Coq or Lean, where abstraction makes it easier to write proofs, but outside of actual formal mathematics i don't see much use. esp given that programmers aren't trained in abstract algebra / category theory, so you end up with a bazillion "monads are like bananas" blog posts that just confuse everything further animist fucked around with this message at 19:47 on Jun 19, 2020 |
# ? Jun 19, 2020 19:41 |
|
Cybernetic Vermin posted:also, of course, haskell does not claim ieee-754 has associative addition. Haskell's numeric hierarchy is awful and its treatment of floating point numbers indefensible[*]. Like, Haskell will round floating-point infinity to integers without problem (it's 340282366920938463463374607431768211456 if you ever wanted to know). And NaN is -269653970229347386159395778618353710042696546841345985910145121736599013708251444699062715983611304031680170819807090036488184653221624933739271145959211186566651840137298227914453329401869141179179624428127508653257226023513694322210869665811240855745025766026879447359920868907719574457253034494436336205824. Useful, that. I have no idea why the Haskell designers decided to return garbage results instead of throwing an exception (there's other partial functions in the Prelude after all), but I suspect they just never did any numerical computing. [*]: not literally, it's fine if you never care about edge cases. PS: lawful algebra-inspired type classes are cool and good, and it is cool and good that (modern) Haskell puts so much emphasis on them, even if that brings the horror of having to learn new words and concepts.
|
# ? Jun 19, 2020 19:42 |
|
Destroyenator posted:f# does some compile time generic resolution for operators and other inline-ables: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/generics/statically-resolved-type-parameters is that solving the same thing or am i misunderstanding this? yep. invoking arbitrary methods on generic types has a pretty ugly syntax, but the #1 use case for the feature is generalisation over numeric operators in which case you just need the `inline` keyword and the operator constraints will be inferred by the f# compiler. worth noting that it's all compile-time resolution that gets inlined at runtime, because the .net runtime doesn't actually support it. so in c# you have to write out the overloads for every primitive numeric type and no, that isn't an excuse for golang in the slightest because .net generics are FIFTEEN YEARS OLD and they still support about four fifths of the features that the golang draft explicitly refuses to provide
|
# ? Jun 19, 2020 19:46 |
|
Cybernetic Vermin posted:as if there is such a thing as code which ever should generalize over integers, floats and strings. I dunno, code that’s generalized over ordering of things seems pretty useful.
|
# ? Jun 19, 2020 19:56 |
|
Subjunctive posted:I dunno, code that’s generalized over ordering of things seems pretty useful. right, but that is the exhaustive list, as opposed to the broader class of things which have a total order. those three have nothing useful in common which is not shared by a lot of other stuff. to be clear: the issue is that '+' on those do very different things in a way which makes code for one very unlikely to do something useful for both others. if the go people had just gone "there are precisely two type classes: 1) the class of things which are hashable and can be checked for equality; and; 2) the totally ordered things. here are all our basic collections defined in a type-safe way in terms of only those two" it would at least have fit their approach of providing a bare minimum as they don't expect programmers to be able to handle anything more.
|
# ? Jun 19, 2020 20:22 |
|
rjmccall posted:c++ having a stable abi was a recent major controversy on the committee AFAIK large part of the problem is that C++ doesn't actually guarantee the ABI stability, but saying "but this breaks ABI" torpedoes proposals. At the same time, MSVC used to change its own stdlib ABI regularly, and while it currently keeps the same ABI, that is only temporary thing.
|
# ? Jun 19, 2020 20:24 |
|
Athas posted:PS: lawful algebra-inspired type classes are cool and good, and it is cool and good that (modern) Haskell puts so much emphasis on them, even if that brings the horror of having to learn new words and concepts. i like Lean where to implement a classes like that you have to actually supply proofs that the relevant properties hold. like: code:
to implement the typeclass for your type, you have to provide a function with that signature... which is basically the same thing as proving that the property holds for your type. so you literally can't provide an incorrect implementation. pretty wild animist fucked around with this message at 20:36 on Jun 19, 2020 |
# ? Jun 19, 2020 20:27 |
|
Cybernetic Vermin posted:honestly i've never seen much point in haskell's super-abstract type classes. they make sense in, like, Coq or Lean, where abstraction makes it easier to write proofs, but outside of actual formal mathematics i don't see much use. esp given that programmers aren't trained in abstract algebra / category theory, so you end up with a bazillion "monads are like bananas" blog posts that just confuse everything further i would like to express things like units of measurement types without wanting to die
|
# ? Jun 19, 2020 20:34 |
|
you can't eat a monad
|
# ? Jun 19, 2020 20:35 |
|
|
# ? Jun 6, 2024 09:33 |
|
animist posted:yeah true.
|
# ? Jun 19, 2020 20:37 |