#c: Haskell
Explore tagged Tumblr posts
void-botanist · 2 years ago
Note
Happy STS! If your characters went out to karaoke, which song would they belt out at the top of their lungs?
Finally getting to this one! My mind remains full of Elbas Island so if we pretended that they know Earth music:
Milo: the idea of him doing Barbie Girl with Binna, where he is Barbie and Binna is Ken is just too funny to not be the answer.
Nidilaenn: Major Tom (Coming Home).
Ellery: Poor Unfortunate Souls. He wants to be dramatic about it and he wants you to understand how dramatic he's being about it.
Patience: Hollaback Girl. You know Mel is singing backup.
Mel: Last Dance by Donna Summer.
Tirias: she literally cannot sing so she would either put on a song everyone knows (All Star) and let them sing it while she hams it up or announce that this is a rendition of John Cage's 4'33". These two things get different responses from the audience but they are functionally the same thing.
Ysa: Friends in Low Places by Garth Brooks.
Rae: Any Way You Want It by Journey.
Madge: Sucker by Jonas Brothers.
Rigo: Break My Heart by Dua Lipa.
Haskell: no, I don't do karaoke, no...well, I guess... Girls Just Wanna Have Fun.
Lacey: the most heartfelt rendition of Mary Had A Little Lamb you've ever heard.
4 notes · View notes
secondwheel · 6 months ago
Text
Tumblr media
This again?? Check out a similar post for the sciences
44 notes · View notes
theveryevilblog · 1 month ago
Text
Haskell > anything else
Haskell is the best programming language because it lets you write a fully functioning web server with three lines of code and zero understanding of how anything works You don't write programs, you declare intentions, and the compiler decides if you're worthy Every other language lets you make mistakes. Haskell waits patiently then destroys your ego at compile time Besides, who needs to 'build skill' in programming anyway?
Not even comparable to python, which is just... so annoyingly uncomplicated and pointless (to make good python syntax you need to make it as un-python as possible) and javascript? Who needs fast languages anyway? So unsatisfying And don't even get me started on C, C++ or C#, which are literally the same language by the way Rust? Bro, just send me the virus already. I don't care PHP? What does that even stand for? Poverty Holding Person? Like you? Java? You stopped being relevant about thirty years ago Swift? Buddy, I do not care about your apple vision pro R? You couldn't even spare another letter? What are you, C-- or something? Ruby? Just admit that Ruby on Rails died last decade... Go? Go where? Out the door? Because currently, that is what Go developers are being asked to do by employers Perl? I don't even know what that language is
6 notes · View notes
red-viscountess-emika · 8 months ago
Text
a Tridaily Dose of Emika
(because of exams)
programming languages I use
I do programming, sometimes. I will list the languages I know, chronologically.
Scratch (when I was 10 or something)
Processing/weird combination of a Java library and a very shitty integrated code environment that comes with it, or whatever that word is. (when I was 14, maybe??)
Python (I dunno, used it for the first time at 16, I would guess)
C (when I was either 20 or 19)
HTML, CSS, Javascript (when I was 20??)
Haskell (when I was 20 (I am still 20))
So Scratch is just adorable, right??
Processing?? I dunno, it helped me learn the concepts????? It was really weird looking back at it. I feel like I was very shitty, but it had a library to make visual stuff easy, so it worked. I wouldn't know how to use actual Java, though, because classes were an advanced concept for me back then, and I forgot it since, and I don't ever use classes with the other languages I use.
Python sucks so bad, I hate it, but school coerces me into using it sometimes.....
C is my favourite, and the one I'm the best at. It's just very satisfying, I guess. I've been building a datastructure library lately.
HTML and CSS are kinda funny, Javascript sucks, but you need it I guess
Haskell is so cute, I love it, but I suck at it as of now. I had a month orso of using it and then went back to C, but I do plan to learn more of it later on :3 now, I will tell you more about these languages
Scratch is just some little kid who is throwing paint around (they are fine??? like they're a kid.... you can't judge them)
Processing is some friendly old white dude (he is fine)
Python is some 30-year old in lower upper management of some multinational who thinks very highly of himself and stuff (we hate him)
C is a 25-year old non-binary cool person (we like them)
HTML is not a person
CSS is not a person either
Javascript, we don't know enough to tell, and with we, we mean I
Haskell is a 16 or 17 year old alt girl (we like her)
12 notes · View notes
cerulity · 7 days ago
Text
Too many languages tack on null as an implicit variant of a value, be it a local, parameter, or member. I think that is a language design error.
Null is a distinct type.
If something may be null, it can only be so if its type is a union of the object's non-null type and the null type. Newer languages are pivoting to explicit null. Rust has Option, Haskell has Maybe, and most others use a ? after the type name. Any way you implement it, it's explicit. Null reference exceptions should not be as common as they are, but two of the most popular languages are Java and JavaScript, and they are culprits of null unsafety. Java allows you to pass null into any non-primitive, and JavaScript has two nulls, alongside the weakest type system I've ever seen (which I also believe is a language design error for how critically the language is used).
When you accept a string as a parameter of a function, you should expect, well, a goddamn string. Not "fuck around and find out".
6 notes · View notes
watchmorecinema · 2 years ago
Text
Normally I just post about movies but I'm a software engineer by trade so I've got opinions on programming too.
Apparently it's a month of code or something because my dash is filled with people trying to learn Python. And that's great, because Python is a good language with a lot of support and job opportunities. I've just got some scattered thoughts that I thought I'd write down.
Python abstracts a number of useful concepts. It makes it easier to use, but it also means that if you don't understand the concepts then things might go wrong in ways you didn't expect. Memory management and pointer logic is so damn annoying, but you need to understand them. I learned these concepts by learning C++, hopefully there's an easier way these days.
Data structures and algorithms are the bread and butter of any real work (and they're pretty much all that come up in interviews) and they're language agnostic. If you don't know how to traverse a linked list, how to use recursion, what a hash map is for, etc. then you don't really know how to program. You'll pretty much never need to implement any of them from scratch, but you should know when to use them; think of them like building blocks in a Lego set.
Learning a new language is a hell of a lot easier after your first one. Going from Python to Java is mostly just syntax differences. Even "harder" languages like C++ mostly just mean more boilerplate while doing the same things. Learning a new spoken language in is hard, but learning a new programming language is generally closer to learning some new slang or a new accent. Lists in Python are called Vectors in C++, just like how french fries are called chips in London. If you know all the underlying concepts that are common to most programming languages then it's not a huge jump to a new one, at least if you're only doing all the most common stuff. (You will get tripped up by some of the minor differences though. Popping an item off of a stack in Python returns the element, but in Java it returns nothing. You have to read it with Top first. Definitely had a program fail due to that issue).
The above is not true for new paradigms. Python, C++ and Java are all iterative languages. You move to something functional like Haskell and you need a completely different way of thinking. Javascript (not in any way related to Java) has callbacks and I still don't quite have a good handle on them. Hardware languages like VHDL are all synchronous; every line of code in a program runs at the same time! That's a new way of thinking.
Python is stereotyped as a scripting language good only for glue programming or prototypes. It's excellent at those, but I've worked at a number of (successful) startups that all were Python on the backend. Python is robust enough and fast enough to be used for basically anything at this point, except maybe for embedded programming. If you do need the fastest speed possible then you can still drop in some raw C++ for the places you need it (one place I worked at had one very important piece of code in C++ because even milliseconds mattered there, but everything else was Python). The speed differences between Python and C++ are so much smaller these days that you only need them at the scale of the really big companies. It makes sense for Google to use C++ (and they use their own version of it to boot), but any company with less than 100 engineers is probably better off with Python in almost all cases. Honestly thought the best programming language is the one you like, and the one that you're good at.
Design patterns mostly don't matter. They really were only created to make up for language failures of C++; in the original design patterns book 17 of the 23 patterns were just core features of other contemporary languages like LISP. C++ was just really popular while also being kinda bad, so they were necessary. I don't think I've ever once thought about consciously using a design pattern since even before I graduated. Object oriented design is mostly in the same place. You'll use classes because it's a useful way to structure things but multiple inheritance and polymorphism and all the other terms you've learned really don't come into play too often and when they do you use the simplest possible form of them. Code should be simple and easy to understand so make it as simple as possible. As far as inheritance the most I'm willing to do is to have a class with abstract functions (i.e. classes where some functions are empty but are expected to be filled out by the child class) but even then there are usually good alternatives to this.
Related to the above: simple is best. Simple is elegant. If you solve a problem with 4000 lines of code using a bunch of esoteric data structures and language quirks, but someone else did it in 10 then I'll pick the 10. On the other hand a one liner function that requires a lot of unpacking, like a Python function with a bunch of nested lambdas, might be easier to read if you split it up a bit more. Time to read and understand the code is the most important metric, more important than runtime or memory use. You can optimize for the other two later if you have to, but simple has to prevail for the first pass otherwise it's going to be hard for other people to understand. In fact, it'll be hard for you to understand too when you come back to it 3 months later without any context.
Note that I've cut a few things for simplicity. For example: VHDL doesn't quite require every line to run at the same time, but it's still a major paradigm of the language that isn't present in most other languages.
Ok that was a lot to read. I guess I have more to say about programming than I thought. But the core ideas are: Python is pretty good, other languages don't need to be scary, learn your data structures and algorithms and above all keep your code simple and clean.
20 notes · View notes
c-official · 2 months ago
Text
It feels like f# hates me. If you write a function that takes a generic argument tou have to name a variable. Because if you write it as a result of some function composition then it is not a function but instead a variable that holds a function, and variables can not have generic type.
And because Microsoft it is also a part of the dotnet hell.
0 notes
snailspng · 9 months ago
Text
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Random PNGs, part 193.
(1. Red Sun by Alexander Calder (1970), 2. Bone & coral charms from the Pitt Rivers Museum, 3. Botryoidal fluorite on amethyst, 4. Charm bracelet by Miriam Haskell, 5. Alien Hand by H. R. Giger (1979), 6. Greek gold earring with gemstones (5th-3rd c. BC), 7. Platanthera ciliaris, 8. Beaded necklace by Miriam Haskell, 9. ???)
2K notes · View notes
solcattus · 1 year ago
Text
Tumblr media
Retrospection, c. 1913
By Ernest Haskell
3K notes · View notes
janokenmun · 4 months ago
Text
o hi i use both of them! in particular rust is my favorite programming language
rust: fast like C/C++ but memory management doesnt suck unlike C/C++
If any Haskell and or Rust fans follow me, give me 1 good reason to learn them
33 notes · View notes
endythebendy · 1 year ago
Text
"So you know how C is procedural, Haskell is functional, and Java is object-oriented? You may ask: 'what about Python?'
Well, Python is bullshit-oriented."
My friend, teaching me Python.
315 notes · View notes
anocana · 1 year ago
Text
under socialism, we will place all computer systems and education under the strict direction of a planning committee composed entirely of stringent programming language theorists, who will reorient the relationship between concrete and abstract so that physical computers are merely mechanisms to incarnate transcendent mathematical principles. a great flowering of new programming languages will take place; Haskell and Coq will be considered aeolipiles to the true programming languages yet to come; C will be retained as a historical curiosity with an esolang subculture that uses it for fun; C++ will be subject to damnatio memoriae. this state of affairs will last six years before the entire committee is executed in a Thermidorean coup led by the Scriptists, who will institute JavaScript as the only legal programming language, banning all others and purging their erstwhile allies the Delphists.
577 notes · View notes
bikinibottomdayz · 8 months ago
Text
Tumblr media
NOVEMBER 10, 2024 RELEASE
All my videos can be found here, full release under the read more! If interested, please contact me at [email protected]!
This release includes: Romeo + Juliet, & Juliet (cast change), Death Becomes Her, Moulin Rouge! (Aaron + JoJo), Ragtime, Safety Not Guranteed
& JULIET October 27, 2024 (E) | Broadway | 4K MP4 (10.56GB) | bikinibottomday’s master Cast: Maya Boyd (Juliet), Alison Luff (Anne), Drew Gehling (Shakespeare), Megan Kane (u/s Nurse), Paulo Szot (Lance), Justin David Sullivan (May), Philippe Arroyo (Francois), Ben Jackson Walker (Romeo), Phil Colgan (s/w Crosse/Bathroom Attendant), Andrew Chappelle (Lord Capulet/Sly), Virgil Gadson (Augustine), Makai Hernandez (Richard), Najah Hetsberger (Lady Capulet/Nell), Joomin Hwang (Kempe), Khailah Johnson (Judith/Rosaline), Ava Noble (s/w Titania), Jasmine Raphael (Imogen), Matt Raffy (Gregory), Bex Robinson (Charion), Tiernan Tunniclffe (Eleanor/Benvolio) Notes: Excellent 4K capture of cast change performance! Final performance for Philippe, Justin, Ben, Phil, Andrew, Virgil, Megan, Jasmine, Matt, Bex, and Tiernan. Minor obstruction that blocks off some action on the right but is worked around well. Some moments of wandering and unfocusing. Includes curtain call and the post-show speech, audio is fed from external source. https://flic.kr/s/aHBqjBPL3Y | ASKING $20 USD NOT FOR SHARING EXCEPT THROUGH ME UNTIL MAY 2, 2025
DEATH BECOMES HER October 23, 2024 | Broadway (Previews) | 4K MP4 (10.07GB) | bikinibottomday’s master Cast: Megan Hilty (Madeline Ashton), Jennifer Simard (Helen Sharp), Christopher Sieber (Ernest Melville), Michelle T. Williams (Viola Van Horn), Marija Abney (Ensemble), Lauren Celentano (Ensemble), Sarita Colón (Ensemble), Kaleigh Cronin (Ensemble), Natalie Charle Ellis (Ensemble), Taurean Everett (Ensemble), Michael Graceffa (Ensemble), Neil Haskell (Ensemble), Kolton Krouse (Ensemble), Josh Lamon (Ensemble), Sarah Meahl (Ensemble), Ximone Rose (Ensemble), Sir Brock Warren (Ensemble), Bud Weber (Ensemble), Ryan Worsing (Ensemble), Warren Yang (Ensemble) Notes: Excellent 4K capture of this show’s first preview! Minor head obstruction on the far left and on the bottom, doesn't block action except for a few moments. Some short blackouts scattered throughout the show because of people getting up and walking the aisles. Increased wandering / readjustment and unfocusing throughout. Includes curtain call, audio is fed from external source. https://flic.kr/s/aHBqjBPwL6 | ASKING $20 USD NOT FOR SHARING EXCEPT THROUGH ME UNTIL MAY 2, 2025
MOULIN ROUGE! October 2, 2024 (E) | Broadway | 4K MP4 (10.43GB) | bikinibottomday’s master Cast: Joanna "JoJo" Levesque (Satine), Aaron Tveit (Christian), Patrick Clanton (s/b Harold Zidler), David Harris (The Duke of Monroth), André Ward (Toulouse Lautrec), Alexander Gil Cruz (Santiago), Sophie Carmen-Jones (Nini), Nicci Claspell (Arabia), Jacqueline B. Arnold (La Chocolat), Jeigh Madjus (Baby Doll), Nick Martinez (Pierre), Giovanni Bonaventura (s/w Ensemble), Cameron Burke (s/w Ensemble), Aaron C. Finley (Ensemble), Bahiyah Hibah (Ensemble), Kamal Lado (Ensemble), Heather Makalani (Ensemble), Kaitlin Mesh (Ensemble), Jenn Stafford (Ensemble), Brooke Taylor (Ensemble), Alex Varcas (Ensemble), Frank Viveros (Ensemble), Cole Joseph Wachman (Ensemble), Michael Bryan Wang (s/w Ensemble), Jordan Wynn (Ensemble) Notes: Excellent 4K capture of the show’s 1500th performance! Three short blackouts, lasting 90 seconds near the end of “Sympathy for the Duke,” 30 seconds after “Nature Boy,” and 25 seconds after “Backstage Romance.” Action on the far left and on the walkway is somewhat obstructed. A railing is also visible and occasionally blocks off action but is usually unintrusive. Some wandering and unfocusing throughout. Includes curtain call, and encore, audio is fed from external source. https://flic.kr/s/aHBqjBL7yf | ASKING $20 USD NOT FOR SHARING EXCEPT THROUGH ME UNTIL MAY 2, 2025
RAGTIME November 3, 2024 (E) | Broadway | 4K MP4 (10.86GB) | bikinibottomday’s master Cast: Joshua Henry (Coalhouse Walker Jr.), Caissie Levy (Mother), Brandon Uranowitz (Tateh), Nichelle Lewis (Sarah), Colin Donnell (Father), Ben Levi Ross (Mother’s Younger Brother), Matthew Lamb (Little Boy), Tabitha Lawing (Little Girl), Stephanie Styles (Evelyn Nesbit), Shaina Taub (Emma Goldman), John Clay III (Booker T. Washington), Todd Cyrus (Harry Houdini), Kai Latorre (Coalhouse Walker III), Nicholas Barrón, Briana Carlson-Goodman, Billy Cohen, Rheaume Crenshaw, Tanika Gibson, Olivia Hernandez (Kathleen), David Jennings, Marina Kondo, Jeff Kready (Henry Ford), Tiffany Mann (Sarah’s Friend), Morgan Marcell, Tom Nelis (Grandfather), Ramone Nelson, John Rapson (J.P. Morgan / Admiral Peary), Destinee Rea, Deandre Sevon, Kathy Voytko, Jacob Keith Watson (Willie Conklin), Alan Wiggins Notes: Excellent 4K capture of this very anticipated production! Minor head obstruction blocks off some action on the far left during the opening number but disappears for the rest of the show. Increased wandering and unfocusing throughout. Some washout on the wider shots. Includes curtain call, audio is fed from external source. https://flic.kr/s/aHBqjBQEix | ASKING $20 USD NOT FOR SHARING EXCEPT THROUGH ME UNTIL MAY 2, 2025
ROMEO + JULIET October, 2024 | Broadway | 4K MP4 (10.1GB) | bikinibottomday’s master Cast: Kit Connor (Romeo), Rachel Zegler (Juliet), Taheen Modak (Benvolio), Gabby Beans (Mercutio/Friar Laurence), Solá Fádìran (Lord Capulet/Lady Capulet), Tommy Dorfman (Tybalt/The Nurse), Daniel Velez (u/s Paris/Sampson/Peter), Nihar Duvvuri (Balthasar), Jasai Chase-Owens (Gregory), Daniel Bravo Hernández (Abraham) Notes: Excellent 4K capture of this star-studded revival! Minor head obstruction that doesn’t block off anything. Action that takes place on the catwalk and on the far sides of the theatre (not on stage) are mostly uncaptured. One blackout in both acts lasting 40 seconds each. Some moments of wandering / readjustment and unfocusing. Includes curtain call, audio is fed from external source. https://flic.kr/s/aHBqjBQ9bx | ASKING $20 USD NOT FOR SHARING EXCEPT THROUGH ME UNTIL MAY 2, 2025
SAFETY NOT GUARANTEED September 26, 2024 | BAM (Previews) | 4K MP4 (8.12GB) | bikinibottomday’s master Cast: Nkeki Obi-Melekwe (Darius), Taylor Trensch (Kenneth), Pomme Koch (Jeff), Rohan Kymal (Arnau), Ashley Pérez Flanagan (Liz/Belinda/Others), John-Michael Lyles (Tristan/Others) Notes: Excellent 4K capture of this world premiere musical! Increased moments of wandering / readjustment and unfocusing throughout. Includes curtain call, audio fed from external source. https://flic.kr/s/aHBqjBKeEe | ASKING $20 USD NOT FOR SHARING EXCEPT THROUGH ME UNTIL MAY 2, 2025
109 notes · View notes
sed-official · 3 months ago
Note
im good! was just eating dinner (chicken and pasta), and have had a great rest day today with my dogs. i did nothing of note! yippee!
how are you?
echo -n "meo" && while [ 1 ]; do echo -n "w"; done
- @sed-official
MEOWWWWWWWWWWWWWWWW
hi sed how are you
8 notes · View notes
anheliotrope · 8 months ago
Text
Rambling About C# Being Alright
I think C# is an alright language. This is one of the highest distinctions I can give to a language.
Warning: This post is verbose and rambly and probably only good at telling you why someone might like C# and not much else.
~~~
There's something I hate about every other language. Worst, there's things I hate about other languages that I know will never get better. Even worse, some of those things ALSO feel like unforced errors.
With C# there's a few things I dislike or that are missing. C#'s feature set does not obviously excel at anything, but it avoids making any huge misstep in things I care about. Nothing in C# makes me feel like the language designer has personally harmed me.
C# is a very tolerable language.
C# is multi-paradigm.
C# is the Full Middle Malcomist language.
C# will try to not hurt you.
A good way to describe C# is "what if Java sucked less". This, of course, already sounds unappealing to many, but that's alright. I'm not trying to gas it up too much here.
C# has sins, but let's try to put them into some context here and perhaps the reason why I'm posting will become more obvious:
C# didn't try to avoid generics and then implement them in a way that is very limiting (cough Go).
C# doesn't hamstring your ability to have statement lambdas because the language designer dislikes them and also because the language designer decided to have semantic whitespace making statement lambdas harder to deal with (cough Python).
C# doesn't require you to explicitly wrap value types into reference types so you can put value types into collections (cough Java).
C# doesn't ruin your ability to interact with memory efficiently because it forbids you from creating custom value types, ergo everything goes to the heap (cough cough Java, Minecraft).
C# doesn't have insane implicit type coercions that have become the subject of language design comedy (cough JavaScript).
C# doesn't keep privacy accessors as a suggestion and has the developers pinkie swear about it instead of actually enforcing it (cough cough Python).
Plainly put, a lot of the time I find C# to be alright by process of elimination. I'm not trying to shit on your favorite language. Everyone has different things they find tolerable. I have the Buddha nature so I wish for all things to find their tolerable language.
I do also think that C# is notable for being a mainstream language (aka not Haskell) that has a smaller amount of egregious mistakes, quirks and Faustian bargains.
The Typerrrrr
C# is statically typed, but the typing is largely effortless to navigate unlike something like Rust, and the GC gives a greater degree of safety than something like C++.
Of course, the typing being easy to work it also makes it less safe than Rust. But this is an appropriate trade-off for certain kinds of applications, especially considering that C# is memory safe by virtue of running on a VM. Don't come at me, I'm a Rust respecter!!
You know how some people talk about Python being amazing for prototyping? That's how I feel about C#. No matter how much time I would dedicate to Python, C# would still be a more productive language for me. The type system would genuinely make me faster for the vast majority of cases. Of course Python has gradual typing now, so any comparison gets more difficult when you consider that. But what I'm trying to say is that I never understood the idea that doing away entirely with static typing is good for fast iteration.
Also yes, C# can be used as a repl. Leave me alone with your repls. Also, while the debugger is active you can also evaluate arbitrary code within the current scope.
I think that going full dynamic typing is a mistake in almost every situation. The fact that C# doesn't do that already puts it above other languages for me. This stance on typing is controversial, but it's my opinion that is really shouldn't be. And the wind has constantly been blowing towards adding gradual typing to dynamic languages.
The modest typing capabilities C# coupled with OOP and inheritance lets you create pretty awful OOP slop. But that's whatever. At work we use inheritance in very few places where it results in neat code reuse, and then it's just mostly interfaces getting implemented.
C#'s typing and generic system is powerful enough to offer you a plethora of super-ergonomic collection transformation methods via the LINQ library. There's a lot of functional-style programming you can do with that. You know, map, filter, reduce, that stuff?
Even if you make a completely new collection type, if it implements IEnumerable<T> it will benefit from LINQ automatically. Every language these days has something like this, but it's so ridiculously easy to use in C#. Coupled with how C# lets you (1) easily define immutable data types, (2) explicitly control access to struct or class members, (3) do pattern matching, you can end up with code that flows really well.
A Friendly Kitchen Sink
Some people have described C#'s feature set as bloated. It is getting some syntactic diversity which makes it a bit harder to read someone else's code. But it doesn't make C# harder to learn, since it takes roughly the same amount of effort to get to a point where you can be effective in it.
Most of the more specific features can be effortlessly ignored. The ones that can't be effortlessly ignored tend to bring something genuinely useful to the language -- such as tuples and destructuring. Tuples have their own syntax, the syntax is pretty intuitive, but the first time you run into it, you will have to do a bit of learning.
C# has an immense amount of small features meant to make the language more ergonomic. They're too numerous to mention and they just keep getting added.
I'd like to draw attention to some features not because they're the most important but rather because it feels like they communicate the "personality" of C#. Not sure what level of detail was appropriate, so feel free to skim.
Stricter Null Handling. If you think not having to explicitly deal with null is the billion dollar mistake, then C# tries to fix a bit of the problem by allowing you to enable a strict context where you have to explicitly tell it that something can be null, otherwise it will assume that the possibility of a reference type being null is an error. It's a bit more complicated than that, but it definitely helps with safety around nullability.
Default Interface Implementation. A problem in C# which drives usage of inheritance is that with just interfaces there is no way to reuse code outside of passing function pointers. A lot of people don't get this and think that inheritance is just used because other people are stupid or something. If you have a couple of methods that would be implemented exactly the same for classes 1 through 99, but somewhat differently for classes 100 through 110, then without inheritance you're fucked. A much better way would be Rust's trait system, but for that to work you need really powerful generics, so it's too different of a path for C# to trod it. Instead what C# did was make it so that you can write an implementation for methods declared in an interface, as long as that implementation only uses members defined in the interface (this makes sense, why would it have access to anything else?). So now you can have a default implementation for the 1 through 99 case and save some of your sanity. Of course, it's not a panacea, if the implementation of the method requires access to the internal state of the 1 through 99 case, default interface implementation won't save you. But it can still make it easier via some techniques I won't get into. The important part is that default interface implementation allows code reuse and reduces reasons to use inheritance.
Performance Optimization. C# has a plethora of features regarding that. Most of which will never be encountered by the average programmer. Examples: (1) stackalloc - forcibly allocate reference types to the stack if you know they won't outlive the current scope. (2) Specialized APIs for avoiding memory allocations in happy paths. (3) Lazy initialization APIs. (4) APIs for dealing with memory more directly that allow high performance when interoping with C/C++ while still keeping a degree of safety.
Fine Control Over Async Runtime. C# lets you write your own... async builder and scheduler? It's a bit esoteric and hard to describe. But basically all the functionality of async/await that does magic under the hood? You can override that magic to do some very specific things that you'll rarely need. Unity3D takes advantage of this in order to allow async/await to work on WASM even though it is a single-threaded environment. It implements a cooperative scheduler so the program doesn't immediately freeze the moment you do await in a single-threaded environment. Most people don't know this capability exists and it doesn't affect them.
Tremendous Amount Of Synchronization Primitives and API. This ones does actually make multithreaded code harder to deal with, but basically C# erred a lot in favor of having many different ways to do multithreading because they wanted to suit different usecases. Most people just deal with idiomatic async/await code, but a very small minority of C# coders deal with locks, atomics, semaphores, mutex, monitors, interlocked, spin waiting etc. They knew they couldn't make this shit safe, so they tried to at least let you have ready-made options for your specific use case, even if it causes some balkanization.
Shortly Begging For Tagged Unions
What I miss from C# is more powerful generic bounds/constraints and tagged unions (or sum types or discriminated unions or type unions or any of the other 5 names this concept has).
The generic constraints you can use in C# are anemic and combined with the lack of tagged unions this is rather painful at times.
I remember seeing Microsoft devs saying they don't see enough of a usecase for tagged unions. I've at times wanted to strangle certain people. These two facts are related to one another.
My stance is that if you think your language doesn't need or benefit from tagged unions, either your language is very weird, or, more likely you're out of your goddamn mind. You are making me do really stupid things every time I need to represent a structure that can EITHER have a value of type A or a value of type B.
But I think C# will eventually get tagged unions. There's a proposal for it here. I would be overjoyed if it got implemented. It seems like it's been getting traction.
Also there was an entire section on unchecked exceptions that I removed because it wasn't interesting enough. Yes, C# could probably have checked exceptions and it didn't and it's a mistake. But ultimately it doesn't seem to have caused any make-or-break in a comparison with Java, which has them. They'd all be better off with returning an Error<T>. Short story is that the consequences of unchecked exceptions have been highly tolerable in practice.
Ecosystem State & FOSSness
C# is better than ever and the tooling ecosystem is better than ever. This is true of almost every language, but I think C# receives a rather high amount of improvements per version. Additionally the FOSS story is at its peak.
Roslyn, the bedrock of the toolchain, the compiler and analysis provider, is under MIT license. The fact that it does analysis as well is important, because this means you can use the wealth of Roslyn analyzers to do linting.
If your FOSS tooling lets you compile but you don't get any checking as you type, then your development experience is wildly substandard.
A lot of stupid crap with cross-platform compilation that used to be confusing or difficult is now rather easy to deal with. It's basically as easy as (1) use NET Core, (2) tell dotnet to build for Linux. These steps take no extra effort and the first step is the default way to write C# these days.
Dotnet is part of the SDK and contains functionality to create NET Core projects and to use other tools to build said projects. Dotnet is published under MIT, because the whole SDK and runtime are published under MIT.
Yes, the debugger situation is still bad -- there's no FOSS option for it, but this is more because nobody cares enough to go and solve it. Jetbrains proved anyone can do it if they have enough development time, since they wrote a debugger from scratch for their proprietary C# IDE Rider.
Where C# falls flat on its face is the "userspace" ecosystem. Plainly put, because C# is a Microsoft product, people with FOSS inclinations have steered clear of it to such a degree that the packages you have available are not even 10% of what packages a Python user has available, for example. People with FOSS inclinations are generally the people who write packages for your language!!
I guess if you really really hate leftpad, you might think this is a small bonus though.
Where-in I talk about Cross-Platform
The biggest thing the ecosystem has been lacking for me is a package, preferably FOSS, for developing cross-platform applications. Even if it's just cross-platform desktop applications.
Like yes, you can build C# to many platforms, no sweat. The same way you can build Rust to many platforms, some sweat. But if you can't show a good GUI on Linux, then it's not practically-speaking cross-platform for that purpose.
Microsoft has repeatedly done GUI stuff that, predictably, only works on Windows. And yes, Linux desktop is like 4%, but that 4% contains >50% of the people who create packages for your language's ecosystem, almost the exact point I made earlier. If a developer runs Linux and they can't have their app run on Linux, they are not going to touch your language with a ten foot pole for that purpose. I think this largely explains why C#'s ecosystem feels stunted.
The thing is, I'm not actually sure how bad or good the situation is, since most people just don't even try using C# for this usecase. There's a general... ecosystem malaise where few care to use the language for this, chiefly because of the tone that Microsoft set a decade ago. It's sad.
HOWEVER.
Avalonia, A New Hope?
Today we have Avalonia. Avalonia is an open-source framework that lets you build cross-platform applications in C#. It's MIT licensed. It will work on Windows, macOS, Linux, iOS, Android and also somehow in the browser. It seems to this by actually drawing pixels via SkiaSharp (or optionally Direct2D on Windows).
They make money by offering migration services from WPF app to Avalonia. Plus general support.
I can't say how good Avalonia is yet. I've researched a bit and it's not obviously bad, which is distinct from being good. But if it's actually good, this would be a holy grail for the ecosystem:
You could use a statically typed language that is productive for this type of software development to create cross-platform applications that have higher performance than the Electron slop. That's valuable!
This possibility warrants a much higher level of enthusiasm than I've seen, especially within the ecosystem itself. This is an ecosystem that was, for a while, entirely landlocked, only able to make Windows desktop applications.
I cannot overstate how important it is for a language's ecosystem to have a package like this and have it be good. Rust is still missing a good option. Gnome is unpleasant to use and buggy. Falling back to using Electron while writing Rust just seems like a bad joke. A lot of the Rust crates that are neither Electron nor Gnome tend to be really really undercooked.
And now I've actually talked myself into checking out Avalonia... I mean after writing all of that I feel like a charlatan for not having investigated it already.
72 notes · View notes
nixcraft · 3 months ago
Text
The Union of Software Developers
Alright, alright, settle down everyone! So, the software developers are trying to unionize, right? But first, they're stuck in this endless meeting.
"Okay, so for our official documents, are we going with Python?"
"Python? Are you kidding? It's dynamically typed! We need the rigor of Java!"
"Java? That's so verbose! We should use Rust, for its memory safety!"
"Rust? What about the learning curve? Let's keep it simple with JavaScript!"
"JavaScript? That's... well, JavaScript. We need something functional, like Haskell!"
"Haskell? You want to write a union contract in a purely functional language? Good luck with that! How about C++?"
"C++? Are you trying to make this negotiation take longer?"
A lone voice from the back: "Anyone considered... COBOL?"
The room erupts in chaos.
"Okay, okay, how about we just write it in pseudocode?"
Another voice: "But... which pseudocode standard?"
33 notes · View notes