6 ms·
I'm stuck in this cycle with langs like this. I want to use Nim I want to use Crystal they to me represent real tangible improvements over the languages they we
by Grimm1 6y ago
I'm stuck in this cycle with langs like this. I want to use Nim I want to use Crystal they to me represent real tangible improvements over the languages they were based on but run into the issue of ecosystem and adoption every-time.
I know it's chicken or the egg but I have real problems choosing these languages when they just aren't as battle hardened or package wise versatile as say python or ruby when making decisions for my own tech stacks in a startup or for other companies I have or will work for.
- tomrod 6y agoI hear you. For me it makes compiled languages fun again. I like rust but package maintenance gets rough. Things like this are what I'm enjoying discovering: https://robert-mcdermott.gitlab.io/posts/speeding-up-python-with-nim/ https://robert-mcdermott.gitlab.io/posts/speeding-up-python-...
- elcritch 6y agoSecond that, I find Nim fun to program. Not sure exactly why.. Perhaps, it‘a a bit of the feel of the old Python 2 days, but with better package management, less OO, and static binaries. Or it has more advanced abilities that solve annoying points with static languages like C++ via proper macros. Crystal looks nice too, but I want code that compiles to C/C++, not llvm for embedded work. Not sure about Crystal, but I’ve been able to find all the packages I needed for embedded and even some ML work. That Nim can wrap C/C++ libraries really helps there, otherwise it’d be a pain. For example I wanted to load PNG images, well someone wrapped a C library [1]. Or to create Elixir NIFs (with exception safety!) [2]. Generally if there’s a C/C++ package it only takes a few hours to wrap and use. Nim has some annoying parts, like understanding the ref/var distinction and lack of examples. The documentation is fairly complete otherwise. 1: https://github.com/define-private-public/stb_image-Nim https://github.com/define-private-public/stb_image-Nim 2: https://github.com/wltsmrz/nimler https://github.com/wltsmrz/nimler
- triangleman 6y agoStrange to see powershell core have such poor performance. Isn't it basically .NET in a scripting language? I've had great success grepping through gigs of log files with powershell, though I recognize that's apples to oranges.
- dunefox 6y agoHm, Julia 1.4 takes 9.5 seconds on my machine (Intel i5 4460). Not bad at all.
- aldanor 6y agoIt's neat but (a) it's not a reproducive example as it mostly about the stack and not the computations, (b) you would probably just use Numba for any serious one-liner speeding up in Python (at least for scientific-like computations) and gain cffi, simd, vectorization, interoperatiblity with numpy, typed containers, etc.
- setzer22 6y agoThe "python is performant because you call into C" argument implies that whenever any fundamentally new algorithm is developed you need to do it in C. This is actually gatekeeping things like machine learning to the few that can build and maintain the C code for libraries like TensorFlow. Python is the ultimate glue code scripting language, but you can't build a performant algorithm without an efficient C implementation underneath. With languages like Nim taking performance seriously, people could build a complete implementation of such algorithms from the ground up. This doesn't just mean the core implementation would be easier to maintain. There's a huge gap between people who use the python libraries and people who build the efficient code that runs underneath. This clear division between those two worlds is what makes it difficult from people to jump from one side to the other, and that's why I'm calling this gatekeeping. Not necessarily Nim, but using a performant, simple high level language for this sort of tasks would blur this divide. In practice, this means AI researchers in universities could dive into the code that's actually doing the work, not just play with the toy buttons and levers Google and Amazon left for them to play with.
- aldanor 6y ago? Nim is compiled into C, IIRC, but it uses Nim syntax and rules and you don't call it "C". Same way, Python's Numba is compiled into LLVM IR at runtime, and you basically write Python, with a few limitations. You don't have to write or know any C/C++ to write high-performant numeric algos in numba (just clarifying) and there is no "C implementation underneath" as you're saying. It's also one of the easiest ways for "AI researchers in universities to do the work" because they and their friends probably already know Python but not Nim. Re: ML libraries like lightgbm and many others - they are written in C++ so that there's a public C FFI which can then be wrapped in other languages, and not only in Python. This is probably the most flexible way to do things as opposed to limiting the whole thing to one niche/language. // I'm not saying Nim is bad, Python is good, or any of that - I like alternative languages myself, but being an "AI researcher" and practitioner and spending most of my work time on developing numeric ML algorithms, I'd never look into Nim for doing any serious work, at least not now, partially because then I'd be the only person maintaining whatever I write alone and forever.
- Naac 6y agoAnother problem I've found for me with Nim and Crystal is the lack of editor support compared to other statically typed languages like Java and C++. Arguably a really nice benefit of these languages is the inline error highlighting, which speeds up development. I've found for Nim and Crystal I have to run the compiler in the terminal, look where the errors were, and then find those lines in my editor. LSP support is minimal ( especially when a language is starting out ). My ideal editor for Nim would be Pycharm-like ( open source edition ) with an LSP backend.
- seventh-chord 6y agoI don't get why more editors don't support parsing compiler output to get the file name and line for errors. Its dead simple, no need to run a server, just allow running the compiler from within the editor and have some way of configuring the parsing so it can work with different compilers. Gets you 90% of the value for 10% of the work (because you don't need to do anything to the compiler).
- zelly 6y agoEmacs has been able to do this for a very very long time
- seventh-chord 6y ago"Turing-complete text editor can do anything" :) To be fair, I dont actually know what percentage of editors have that feature, my impression is just that many people arent aware of the idea. Maybe Im wrong though.
- jlokier 6y agoYou don't even need to configure it in many cases. I've been doing it with numerous languages in Emacs, and I think I had to configure it (with a regex) maybe once for a compiler whose output it didn't already recognise. The syntax compilers use to indicate filename and error location are similar among compilers, and generally quite unambiguous anyway, so in many cases no configuration is needed. A small list of regexes built in to the editor is enough.
- etxm 6y agoSame. I was starting a new CLI project the other day and thought “ya know, I’ll try crystal instead of doing this in go.” But then I got to the home page and saw “fund crystal and help make it production ready” and felt like it wasn’t a risk for something I needed to get out the door. I did build a small toy project in Crystal and really enjoyed working with it.
- geodel 6y agoTwo ways to get infrastructure like libraries, editors, IDEs support and so on: 1) Language is sponsored by tech giant or 2) It slowly evolve over period of 15-20 years, provided enough people see usefulness even in face of lacking features/libraries/tooling etc.
- zelly 6y agoIn the case of languages the chicken and the egg problem has been solved. Looking at every major PL with widespread adoption, the common theme is that was chosen by a big company (the chicken) as a natively-supported language for their platform. See: Obj-C and Swift with Apple, C# and C++ with Microsoft, Java with Sun, C with GNU, JS with Netscape, etc. If you build an ecosystem, they will come. Languages that rely on a community to build an ecosystem just for the sake of using the language itself are very few and far between.
- aserafini 6y agoBut interestingly that was not the case for Python which is definitely in the top 5 most popular languages today. I wonder how/why Python accomplished this without any corporate backer?
- dnautics 6y agoSchools. There was ba major push to teach python in high schools and colleges.
- tyingq 6y agoPython, TCL, PHP, Perl, Ruby, Lua, and more. So it happens, just not recently.
- pjmlp 6y agoPython, all the Guido employers, Zope was big during the early 2000's. TCL designed at Sun, pushed on the Web early days with application servers like AOL Server and Revit (or something similar have forgotten the name). Perl was introduced in UNIX since the early days and was the tool to use when sed and awk scripts got too complicated. Ruby was made famous thanks to Rails, and gets very little use outside Rails. Lua, used as scripting language in a couple of game engines, made famous via World of Warcraft.
- tyingq 6y agoTCL was pretty well established before Ousterhout went to Sun.