Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
jboy
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
11 ms
·
31.
▲
by
jboy
11y ago
For anyone who's interested in learning more about Nim, here is Andreas Rumpf (the creator of Nim)'s talk at the OSCON 2015 conference: https://www.youtube.com/watch?v=4rJEBs_Nnaw ; and here's a longer, more-
32.
▲
The film Star Wars stole from
(bbc.com)
2 points
by
jboy
11y ago
|
1 comments
33.
▲
by
jboy
11y ago
You might also be interested to check out Nim. It transpiles to C before invoking the C compiler, so it runs as fast as C++ and has excellent C-compatibility (and by extension, excellent C++-compatibility). Compiling a shared library is as
34.
▲
by
jboy
11y ago
Hi, the short answer is "Yes, but ...". Yes, Pymod's PyArrayObject can be created & accessed entirely in Nim; yes, its length (actually, shape) is specified at runtime; and yes, it can be resized after creation. However,
35.
▲
by
jboy
11y ago
It looks like you need to copy your D array to a newly-allocated Numpy ndarray before you can pass it to Python. So there's no binary PyArrayObject interoperability between D & Python (right?). Copying large N-D arrays all the ti
36.
▲
by
jboy
11y ago
Credit to the D developers for providing a concise, carefully-designed library for N-D array processing. The chained method invocations demonstrate D's UFCS (Uniform Function Call Syntax) nicely. And it's a definite bonus that y
37.
▲
by
jboy
11y ago
In general in Nim (see footnote for fine print), `obj.someFunc` == `obj.someFunc()` == `someFunc(obj)` [0]. It's not a method bound to an object, as in `obj.method` in Python. So whenever there is some `obj.` in front of the function
38.
▲
by
jboy
11y ago
See, this is why I compare it to Python's OSR syntax. People react with these strong responses ("plainly bat-shit crazy"). People focus on inconveniences due to the limitations of limited tools ("I don't want to pr
39.
▲
by
jboy
11y ago
If your functions take any parameters, Nim will use the parameter types to distinguish between them, just like C++ does when you overload functions. OTOH, if your hypothetical is that programmer X writes `to_me()` while a different programm
40.
▲
by
jboy
11y ago
Nim has made 4 syntax choices that might seem bizarre to a C++ programmer: 1. blocks by indentation instead of braces (aka "Off-Side Rule" syntax [0]); 2. Uniform Function Call Syntax [1][2]; 3. case-insensitivity for identifiers;
41.
▲
by
jboy
11y ago
If you like to program in C++ and Python, the Nim language might appeal to you: C++-like features (generic types, operator overloading, function overloading, inline functions, optional O-O, optional data hiding, C pointers, bitwise-compatib
42.
▲
by
jboy
11y ago
> CPython for-loops are slow. PyPy for-loops are not slow. I fear you might have missed the point of that paragraph. The point was that multiple reasons contributed to the need for Numpy, so now it exists and is widely used by those w
43.
▲
by
jboy
11y ago
I elaborated on my thoughts about the Cython language in this sibling comment: https://news.ycombinator.com/edit?id=10578834 I agree with you that Cython is a mature, very respectable project, and it evidently has more wide
44.
▲
by
jboy
11y ago
There is some documentation on the various Nim backends here: http://nim-lang.org/docs/backends.html & http://nim-lang.org/docs/nimc.html#compiler-usage-generated-... That second link describe
45.
▲
by
jboy
11y ago
The preferred workflow that you've described seems to be a (more considered) form of the standard Cython workflow that I see described: (1) Write Python. (2) Compile with Cython. (3) Run compiled Cython, profile & review. (4) Consi
46.
▲
by
jboy
11y ago
Sure, this is a question that people ask quite frequently. I most recently answered it here: https://news.ycombinator.com/item?id=10569768 """Actually, Pymod was designed to be almost an anti-Cython. :) My i
47.
▲
by
jboy
11y ago
This post highlights an interesting dichotomy in the Python scientific computing community. Everyone knows that PyPy runs faster than CPython for many common tasks [1]. [1] PyPy is on average 7x faster than CPython: http://speed
48.
▲
by
jboy
11y ago
Oh absolutely, Nim should definitely get the vast majority of the credit. It's not just because Nim compiles to C; it's also due to Nim's powerful macro system, which: (1) allows me to define my own first-class pragmas such a
49.
▲
by
jboy
11y ago
Interesting! Thanks for the link. After browsing that page, I observe that even when Cython is wrapping an external C library, there's still a notable difference between the way Cython does things & the way Pymod does things. The
50.
▲
by
jboy
11y ago
Actually, Pymod was designed to be almost an anti-Cython. :) My issue with Cython is that it's a limited sub-language within Python, where you add Cython elements incrementally & iteratively (diverging from Python in the process) u
51.
▲
by
jboy
11y ago
As a longtime programmer of Python, C & C++ (and a longtime appreciator of your FQA Lite, by the way), my preference until recently was also to use CPython & fall back on extension modules for speed. But I grew weary of writing all
52.
▲
by
jboy
11y ago
I don't know, I'm sorry. (The majority of my professional & personal programming has been along the Shell-Python-C-C++ axis. My preference for static types increases approximately logarithmically with the size of the program;
53.
▲
by
jboy
11y ago
In Nim, you can use the type `auto` for proc parameters & return types: http://nim-lang.org/docs/manual.html#types-auto-type When you use the `auto` type, the compiler will infer the type automatically from the con
54.
▲
by
jboy
11y ago
I assume you're the article author? If so, I know who you are on the Nim forums, so I'll certainly keep you informed. :) In terms of ecosystems, I think that there is deployed Python code in the world that will never be re-writte
55.
▲
by
jboy
11y ago
Great! I see that you created "pyexperiment" [ https://github.com/duerrp/pyexperiment ], so it's safe to assume you know your way around Python & Numpy. Is there a good way to get in contact with yo
56.
▲
by
jboy
11y ago
Great! Email sent to the address in your profile.
57.
▲
by
jboy
11y ago
Yes, I have, and Julia does look nice. It clearly has some very good libraries for scientific computing, and its syntax looks (to me) like an interesting combination of Python (which I like) and Matlab (which I don't like). Aside from
58.
▲
by
jboy
11y ago
We haven't just thought about it, we intend to do it! :) We're just waiting until we're happy enough with our Numpy array API that we'd be confident in calling it "mostly stable". The (real) Numpy's C API
59.
▲
by
jboy
11y ago
My issue with Cython is that (at least as I've understood it from the tutorials I've read) it's a sub-language within Python, where you add Cython elements iteratively+incrementally (diverging from Python in the process) unti
60.
▲
by
jboy
11y ago
For the last 9 months I've been working (part-time) on a project that does exactly that. The startup where I work makes extensive use of this project to speed up our Python. The basic infrastructure was in place after ~2 months. Sinc
More ›