News for hackers. Stuff that matters.
Re:Nim 2.0.0 RC2 by jphoward on Friday March 31, 2023 @08:07AM (#35385815)
I love Nim so much. I really hope some big company decides to use it as their workhorse language - it feels like the only thing holding it back is the lack of corporate 'buy in'. Most similarly good languages (except F# maybe?) seem to get lucky with becoming a poster boy for at least one company.
Re:Nim 2.0.0 RC2 by carlmr on Friday March 31, 2023 @08:28AM (#35386056)
>Most similarly good languages (except F# maybe?) seem to get lucky with becoming a poster boy for at least one company.

This one I still can't wrap my head around. F# basically was the source of almost all innovation in C# and C# still is missing some features and was not designed in the same way as F# so a lot of the features they "stole" feel tacked on.

Microsoft should have just made F# the C# successor.

Re:Nim 2.0.0 RC2 by solarkraft on Friday March 31, 2023 @08:37AM (#35386164)
I had a brief look at F#, it didn't fit my mental model and I looked away. Meanwhile I do like using the tacked-on functional features in traditional languages because it allows me to get the benefits when it fits what I'm doing instead of having to fully buy in.
Re:Nim 2.0.0 RC2 by Herval_freire on Friday March 31, 2023 @09:20AM (#35386734)
You're just using the tacked on features as syntactic sugar. You haven't "bought in" at all.

I was traditionally trained like you under OOP and procedural methodologies.

After encounter FP I fully bought in and developed two mental models. The fp model lives side by side with the the oop/imperative model.

With equal knowledge in both one can make a more unbiased judgement. The fp model is actually superior imo.

I largely have the opposite strategy now when programming. My mental model is largely fp, and I occasionally cheat and sprinkle in procedural or oop syntax here and there as syntactic sugar.

The basic realization here should be that mutating shared state should be avoided and segregated as much as possible.

Re:Nim 2.0.0 RC2 by ok_dad on Friday March 31, 2023 @11:24AM (#35388508)
> syntactic sugar

To be fair, all languages are syntactic sugar over asm which is s-s over CPU machine code. A mental model is just that: a model for something physical that's in your head. FP or OOP are both mental models for programming in nearly any language. Some languages have first-class FP or OOP features, and some don't, but you can tack-on either of these, and others, to nearly any language you want to. It's really dumb to look down on others choice of mental model if it works for them. I have seen successful projects that were designed around both OOP and FP models.

Re:Nim 2.0.0 RC2 by Herval_freire on Friday March 31, 2023 @12:01PM (#35389097)
I'm guessing from the comment that he only has one mental model of oop so he can't have a fully formed a opinion because he can't do an unbiased comparison. So I offered mine. That's all.

Yes everything is technically syntactic sugar but the context in which I used the word implied that the usage is mostly as a shortcut. From his post it seems he's not following a mental model of fp, he's just occasionally using an anonymous function or map and reduce in place of a procedural counterpart.

I'm not looking down on anyone here, let's be clear. I am simply stating my counter opinion to his opinion. That's all.

>I have seen successful projects that were designed around both OOP and FP models.

No project can be fully and perfectly designed around the fp model. This is because there is such a thing as mutating state and side effects. Something has to mutate, side effects must exist. Unless your project is 100 percent Haskell some aspect of it will likely not be fp. Usually for web this is the database or the cache or some function that touches io.

When we talk about the fp model there is merit in saying that it is superior to the oop model. Many experts agree that the most modular form of programming is to use pure combinators as building blocks. The minute you introduce side effects and mutations into the system those side effects pollute the code with modules that are harder to break down and code becomes harder and harder to test.

Many will agree that the goal of the fp model is the reduction of mutation and side effects as much as possible. Write your code in such a way that io and mutation are small, modular and segregated away from your pure logic.

Most people think of fp as map, reduce and "functions as values". This is not the "model of fp". These features of fp exist to overcome the strict rules of fp. They can be used in other contexts as well, but using these "features" in other contexts does not mean you are following the fp model. I have yet to find a person who understands the fp model and does not think it is superior to oop.

The ultimate form of modularity where your code becomes Lego building blocks which you fit together in a sort of type Tetris is only fully realized with fp. No other programming paradigm achieves it as the pure combinator is the most fundamental building block of logic. To do fp is to declare that most of your program will be composed of these modular blocks.

I genuinely believe that if you and the GP fully get what I'm talking about and it clicks for you, both of you will agree. Again I'm not looking down on you guys. Just offering my real opinion. It's unfortunate that in order for me to point out this opinion I have to point out a certain lack of familiarity for FP among the GP and you, but I mean no harm by it. If the tables were turned I would welcome such opinions.

Re:Nim 2.0.0 RC2 by yakubin on Friday March 31, 2023 @02:15PM (#35391014)
Garbage collectors, type systems, modules, polymorphic functions are not syntactic sugar. Asm also isn’t syntactic sugar, if only for the polymorphism (how many different CPU instructions are MOV in Asm again?); or just the fact that it’s text and machine code is binary code, while desugaring code doesn’t change its language.
Re:Nim 2.0.0 RC2 by usrnm on Friday March 31, 2023 @08:45AM (#35386253)
> Microsoft should have just made F# the C# successor.

You underestimate the importance of compatibility and familiarity for existing developers. You can show C# code to any C++, Java or even JS programmer and expect them to grasp the idea of what's going on very quickly. This is a big deal and should not be discarded lightly

Re:Nim 2.0.0 RC2 by carlmr on Friday March 31, 2023 @09:51AM (#35387162)
In terms of looks mostly it just doesn't have as many types and fewer parentheses. Shouldn't be an issue if you know python.
Re:Nim 2.0.0 RC2 by bbkane on Friday March 31, 2023 @10:33AM (#35387737)
In my experience, Algebraic types alone take some work to get used to using competently. That's just one F# uniqueness and there are others. Learning Elm (a similar language) definitely made me a better engineer, but I really don't think learning F# is the same as learning Python for someone with experience with imperative/OO languages.

I think the reason it sometimes seems like it is that easy is that, as we gain experience with tools, we tend to forget the difficulties we had learning them.

Re:Nim 2.0.0 RC2 by carlmr on Friday March 31, 2023 @01:47PM (#35390540)
I had difficulties learning OOP, I always preferred a more functional style, despite "consensus" needing 20 years to catch on that functional programming alleviates a lot of the issues we have with OOP.

Learning F# it instantly clicked.

OOP learning issues IMHO are intrinsic to the style, because it's just so seldom helpful in making programming easier.

Design patterns are just a symptom of this issue. That OOP is just a misunderstanding another.

"Real" OOP as practiced in Erlang/Elixir is quite useful.

Re:Nim 2.0.0 RC2 by karmakaze on Friday March 31, 2023 @11:51AM (#35388946)
I think they are making F# the successor but very slowly by evolving C#. I would also have preferred the direct path.
Re:Nim 2.0.0 RC2 by ecshafer on Friday March 31, 2023 @10:23AM (#35387596)
F# is such a nice language. A great modern ML language on the .net runtime with full MS package support that's pretty awesome. But unlike something like Scala on the JVM F# is so simple and straightforward, it has a lot of features without feeling bloated. The fact that MS has just abandoned F# is disappointing.
Re:Nim 2.0.0 RC2 by imwithstoopid on Friday March 31, 2023 @11:03AM (#35388153)
> Microsoft should have just made F# the C# successor.

their target audience does not want this

Re:Nim 2.0.0 RC2 by crop_rotation on Friday March 31, 2023 @08:19AM (#35385954)
Yup, corporate buy in is a big deal. Years ago I tried using Nim for a network daemon, but the sheer lack of even the most basic http libraries prevented me from doing it and I went with go.

The library situation is a bit better now. But without a big company contributing in terms of libraries, the language usage will just be very low.

Re:Nim 2.0.0 RC2 by FireInsight on Friday March 31, 2023 @08:56AM (#35386414)
Nowadays atleast Nim has multiple compenent http libraries, see https://nimble.directory/search?query=http
Re:Nim 2.0.0 RC2 by michaelsbradley on Friday March 31, 2023 @09:12AM (#35386625)
Not in that list, but nim-chronos also provides a solid http server/client:

https://github.com/status-im/nim-chronos

Re:Nim 2.0.0 RC2 by girvo on Friday March 31, 2023 @08:35AM (#35386140)
While we’re not a big company, my work uses it as our secret weapon for embedded firmware development.
Re:Nim 2.0.0 RC2 by rthomas6 on Friday March 31, 2023 @08:42AM (#35386230)
Do you do FPGA designs with it, or just bare metal software?
Re:Nim 2.0.0 RC2 by girvo on Wednesday April 05, 2023 @06:08PM (#35461072)
Software on microcontrollers :)
Re:Nim 2.0.0 RC2 by MrBuddyCasino on Friday March 31, 2023 @10:43AM (#35387889)
If only it supported RV32IMAC and/or XTensa one could use it on one of the ESP32 variants.
Re:Nim 2.0.0 RC2 by elcritch on Friday March 31, 2023 @01:27PM (#35390222)
Nim supports both since it compiles with pretty much any C89 C compiler. Also https://github.com/elcritch/nesper :)
Re:Nim 2.0.0 RC2 by MrBuddyCasino on Friday March 31, 2023 @03:45PM (#35392455)
Oh nice! This looks very tempting…
Re:Nim 2.0.0 RC2 by elcritch on Friday March 31, 2023 @07:22PM (#35395111)
Feel free to drop by Discord #embedded if you're tempted enough.. ;) I've had production devices running on it for years.
Re:Nim 2.0.0 RC2 by girvo on Monday April 03, 2023 @08:03AM (#35422060)
We use the ESP32-S3 as our main microcontroller!
Re:Nim 2.0.0 RC2 by intelVISA on Friday March 31, 2023 @08:24AM (#35386005)
Unfortunately, it's too good of a language for serious corporate adoption...
Re:Nim 2.0.0 RC2 by squarefoot on Friday March 31, 2023 @11:46AM (#35388868)
Companies base their choice of tools on how easy is to find developers to hire, therefore Nim and other similarly young but very powerful/optimized languages (Crystal, Zig, ...) need many independent developers, who can base their choice purely on technical merits and personal taste, to use it and put it into their resumes before the corporate world can notice and add them into their list of accepted tools. It's a quite slow process though.
Re:Nim 2.0.0 RC2 by pron on Friday March 31, 2023 @08:49AM (#35386321)
Programming language adoption -- like the adoption of many technological products -- is usually really fast. With the possible sole exception of Python, all programming languages, popular and unpopular alike, have reached the general ballpark (i.e. high/mid/low) of their all-time peak market share within 5-10 years. Dark horses are very, very rare.
Re:Nim 2.0.0 RC2 by crop_rotation on Friday March 31, 2023 @08:55AM (#35386402)
In general you are correct. However, language adoption can skyrocket when some new library/framework arrives which has a compelling reason to switch (e.g. Rails for Ruby)
Re:Nim 2.0.0 RC2 by tokai on Friday March 31, 2023 @08:59AM (#35386462)
I can't see how there should be a reliable pattern in language usage like that. Javascript is more used that ever - who knows were the all-time market share peak is - but we're well beyond your 5-10 year time frame. Could you name any languages that actually have this pattern? Julia maybe.
Re:Nim 2.0.0 RC2 by pron on Friday March 31, 2023 @11:32AM (#35388648)
All languages, except possibly Python, have followed this patterns. Read my comment carefully: I said that virtually all languages reach their ballpark market share within 10 years. JS did reach its high market share ballpark within a decade.
Re:Nim 2.0.0 RC2 by tokai on Friday March 31, 2023 @12:05PM (#35389162)
I understand what you are writing. But it only holds for you because your idea of ballpark is exceedingly wide. It's doesn't hold at all for the usage numbers I look at without your socalled ballpark being several magnitudes.
Re:Nim 2.0.0 RC2 by pron on Friday March 31, 2023 @12:28PM (#35389471)
JS's market share did not grow by even one order of magnitude since ~2006 nor even close to an order of magnitude. There aren't that many orders of magnitude for a share to grow if you start counting at ~1%.
Re:Nim 2.0.0 RC2 by dsrw on Friday March 31, 2023 @12:50PM (#35389792)
Essentially nobody was a "JavaScript Developer" in 2005, 10 years after JS's release. JQuery didn't exist yet, the term "AJAX" hadn't been coined, and NodeJS was years away. Web developers were using JS to enhance pages, but it wasn't a language that was widely used to write applications. I don't know what the popularity numbers looked like so I'm not saying you're wrong, but it was definitely closer to 15 years before people started to take JS seriously.

JS aside, I think there's probably some survivorship bias going on here. I don't think there are a lot of 15 year old, relatively unpopular languages that are still under active development. Maybe it's not that languages that don't become popular in 10 years never will, but rather that languages that don't become popular in 10 years tend to be abandoned by their developers, thus sealing their fate.

Re:Nim 2.0.0 RC2 by pron on Friday March 31, 2023 @04:00PM (#35392699)
JS was a very popular language in 2006 (at least in the top 10 if not top 5) -- a lot of people were doing at least some JS development -- even though it grew bigger later. Nevertheless, JS (like Objective-C and Swift) is indeed special in the sense that it's the "monopoly language" for a particular platform.

> I don't think there are a lot of 15 year old, relatively unpopular languages that are still under active development.

There are quite a few. If you look in virtually any language ranking, places 10-40 have many 10 year-old and even 15 year-old language. Here are some continuously developed >=15yo languages that are less-than-middling-popular and have always been so: Common Lisp, Racket, Clojure, OCaml, SML/NJ, F#, TCL, Haskell, Idris, Groovy, Squeak, Erlang, D, Ada, Nim. There are more of these than there are super-popular languages. (I didn't include any language that was, at one time, at least somewhat popular but is no longer, such as Visual Basic, Delphi, and Perl 5).

There might still be survivorship bias, but I am not saying all that is fate, just a clear historical observation.

Re:Nim 2.0.0 RC2 by fluoridation on Friday March 31, 2023 @10:38AM (#35387818)
C++ was designed in the late '70s-early 80's and reached peak popularity in the mid-to-late '90s. JavaScript appeared in the mid-'90s and didn't see broad adoption until about the '10s. I would say that the norm is for peak adoption to happen at around the 10-15 year mark of original release. Languages that get adopted faster than 7 years are unusual, and it indicates that they came out at highly opportune times to address specific needs. I'm thinking in particular of Java and Rust, for example, which were both reached critical masses of adoption very quickly.
Re:Nim 2.0.0 RC2 by pron on Friday March 31, 2023 @10:53AM (#35388036)
C++ was released in 1985 and it certainly reached the ballpark of its peak popularity in its first decade. JS did the same.

> Languages that get adopted faster than 7 years are unusual, and it indicates that they came out at highly opportune times to address specific needs.

Not only is it not unusual, over hundreds of languages I think there has really been one exception (for 10 years; maybe not 7). At age 10 how well a language does is more or less how well it's ever going to do.

Re:Nim 2.0.0 RC2 by fluoridation on Friday March 31, 2023 @02:11PM (#35390952)
JS took well over 10 years to reach massive popularity. C++ took a bit over 10.
Re:Nim 2.0.0 RC2 by pron on Friday March 31, 2023 @04:02PM (#35392724)
That's a definite no on either one. JS was very popular (top 5-10) in 2006 and C++ was very close to its peak popularity in 1995 (and already declining five years later). Maybe Ruby took 11 years, but that's close enough. Over scores or even hundreds of languages, I think Python is the only clear exception. It wasn't unpopular in 2005 (it was in the top 20), but it certainly moved up a rank from middling popularity to super-popularity well after 10 years old.
Re:Nim 2.0.0 RC2 by zem on Friday March 31, 2023 @01:35PM (#35390351)
ocaml managed, but it took a significant effort to improve the general tooling ecosystem
Re:Nim 2.0.0 RC2 by ThomasTJdev on Friday March 31, 2023 @09:03AM (#35386513)
Ditto! Nim is just easy and incredibly fast (to develop and the code!). Our code base is Nim based - even normal bash script have been replaced!
Re:Nim 2.0.0 RC2 by alexbezhan on Friday March 31, 2023 @12:35PM (#35389565)
What app are you developing with it?
Re:Nim 2.0.0 RC2 by ThomasTJdev on Friday March 31, 2023 @05:18PM (#35393802)
A full project management platform for construction projects. Webserver, websocket, microservices, etc.: https://cxplanner.com
Re:Nim 2.0.0 RC2 by treeform on Friday March 31, 2023 @12:38PM (#35389616)
Re:Nim 2.0.0 RC2 by riku_iki on Friday March 31, 2023 @01:26PM (#35390210)
he said he works on some internal tool, but not clear how wide is adaptation outside of that.
Re:Nim 2.0.0 RC2 by v3ss0n on Friday March 31, 2023 @12:51PM (#35389816)
The main problem is people afraid about Style Insensitivity it enables by default .
Re:Nim 2.0.0 RC2 by elcritch on Friday March 31, 2023 @01:25PM (#35390187)
Its set to produce a compiler "Warning" by default now.
Re:Nim 2.0.0 RC2 by j-james on Friday March 31, 2023 @03:07PM (#35391842)
(for inconsistent usage)

As background, style insensitivity was introduced so that codebases can use a consistent camelCase or snake_case regardless of the style used by upstream libraries.

Re:Nim 2.0.0 RC2 by girvo on Monday April 03, 2023 @03:15AM (#35419675)
Which as an aside, makes writing and using C bindings so lovely.
Re:Nim 2.0.0 RC2 by j-james on Tuesday April 04, 2023 @09:25PM (#35448064)
Well, maybe not writing. Occasionally low-level C libraries - especially those that deal with keyboard input - decide to provide identifiers differing only in case... There's a WIP RFC for providing a way to deal with identifiers that need to be verbatium by surrounding them with backticks, though.

https://github.com/nim-lang/RFCs/issues/477

Re:Nim 2.0.0 RC2 by esafak on Friday March 31, 2023 @03:22PM (#35392084)
I am in a position to do this and I picked kotlin instead as the tooling is not good enough yet. Without a good IDE experience you lose some of the productivity that nim potentially offers.