Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
atilaneves
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
8 ms
·
31.
▲
by
atilaneves
7y ago
> You don't need to modify the code, just add a wrapper. Still not the same. > Nothing prevents generating a wrapper automatically but 99% of the time that is not very useful. The large majority of Python extension contain Python
32.
▲
by
atilaneves
7y ago
I can't really comment without an example. I don't think this approach stops you from doing anything. It can (and has) allowed Python to call into templated D code, as long as you give the particular instantiation you're inte
33.
▲
by
atilaneves
7y ago
After a week, I've finally had time to look at cffi. It's not even remotely as easy. I tried using it just now to call nanomsg and gave up immediately. I can't just give it the headers, I have to pass it a string which is val
34.
▲
by
atilaneves
7y ago
So just like the article describes.
35.
▲
by
atilaneves
7y ago
There's no way to parse headers without a compiler.
36.
▲
by
atilaneves
7y ago
So... ctypes requires writing glue code. The solution in the article doesn't. "if needed" means "needed with any and all C APIs one would be interested in".
37.
▲
by
atilaneves
7y ago
No, ctypes does not. It can't handle macros, and it requires users to define the structures in Python themselves. It's miles away from what's in the blog post.
38.
▲
by
atilaneves
7y ago
That already works with Python, Excel and C# now. There's a link in the blog post to another blog post to that effect.
39.
▲
by
atilaneves
7y ago
Literally all of it.
40.
▲
by
atilaneves
7y ago
While nice, one still has to manually declare a Nim proc and tell it whence it came from. That's not the same.
41.
▲
by
atilaneves
7y ago
Thanks for the links. That's nice, but not the same - users have to intend to write a Python extension in Nim. With autowrap, you can call unmodified D code (and as shown in the blog, C code as well with dpp). That means code that wa
42.
▲
by
atilaneves
7y ago
No, but I used the equivalent in Lua. I was under the impression that no solution handled preprocessor macros, but this thread corrected me. I might do a follow-up post on this.
43.
▲
by
atilaneves
7y ago
I used swig once. Never again.
44.
▲
by
atilaneves
7y ago
> could you explain the weird fascination of the D community with Excel No, because I'm not aware of one existing. The only reason I wrote excel-d is because of business reasons. > actual Excel in the wild and not libreoffice or
45.
▲
by
atilaneves
7y ago
The solution in the blog post is an extension module. Written for you, by the compiler. Instead of a learning curve and "it's really not hard", it's "no learning curve" and "I struggle to find how this c
46.
▲
by
atilaneves
7y ago
Both pybind11 and boost::python involve writing code. This solution doesn't, save for listing the names of the files to be made available to Python (or C#, or Excel, or...).
47.
▲
by
atilaneves
7y ago
> Do I understand that correctly? Yep! > (The other half of the puzzle being a tool called autowrap that wraps the resulting D for consumption by Python.) Correct. > I'm not sure whether I personally would ever use this, but i
48.
▲
by
atilaneves
7y ago
The last time I looked at the Nim documentation, one had to manually declare C and C++ functions. I don't see how that's different from pretty much any other language that can call C (i.e. pretty much all of them). Then there'
49.
▲
by
atilaneves
7y ago
I'm not an IDE user, but I know that certain D programmers use Visual Studio (with VisualD) and seem happy. Did you try that option?
50.
▲
by
atilaneves
7y ago
I describe how easy it is to call C code from Python by using D as the glue layer. AMA.
51.
▲
Want to call C from Python? Use D
(atilaoncode.blog)
193 points
by
atilaneves
7y ago
|
112 comments
52.
▲
by
atilaneves
7y ago
I work remotely and I agree with everything here except the title: don't work from your bedroom, have a dedicated space for it at home even if it's part of the living room. If you can afford a separate room for it, do that instead
53.
▲
by
atilaneves
7y ago
> There must be a million little micro-cultures in an organization that large There are, and in those, good code can be written. They're the exception. Source: worked there for 7 years.
54.
▲
by
atilaneves
7y ago
I also worked there. It's... not good. Some of the development practices are nearly forced on every one no matter where in the company they work. I could write a book on how bad it is.
55.
▲
by
atilaneves
7y ago
> Does anyone actually have faith in their hw+sw security these days? I worked for 7 years so I know how the software sausage is made. The answer is most definitely "no", and I'm frankly surprised now that the internet wor
56.
▲
by
atilaneves
7y ago
... compared to C and C++. The reason why header-only libraries exist is because C and C++ don't have an official package manager. That's it. Any other language that does can vendor just as easily. Similarly, pretty much every oth
57.
▲
by
atilaneves
7y ago
Why would you?
58.
▲
by
atilaneves
7y ago
No. But it can be done as a library. Granted, it's not the same as 1st class support, but it's pretty good: https://github.com/pbackus/sumtype
59.
▲
by
atilaneves
7y ago
Because it's C++, and the defaults must suck (std::vector::at anyone?)
60.
▲
by
atilaneves
7y ago
> the transparency and predictability of what machine code gets generated from the source code. This gets said a lot, but unless you're writing C code for a microcontroller (or a PDP11), that isn't even close to being true. >
More ›