HNHacker News
TopNewBestAskShowJobs

atilaneves

697 karma · joined December 5, 2013

submissionscomments
atilaneves··on Better C – A subset of D Programming Language
Not in D, it isn't, for performance reasons. It takes an input range and returns a type that iterates through that range applying the callable (doesn't have to be a function!) to each element as requested.
atilaneves··on Two Years with Rust
> Are there any downsides beyond the niggle the author mentioned?

For me, using a GC is just a lot easier than making the borrow checker happy. Given that in practice it's rare that the GC is the bottleneck (and when it is I write around it after profiling), the trade-off just isn't worth it for me.

> Are compilation speeds an issue for anyone?

Yes, it's pretty slow to compile.

atilaneves··on How coffee took over the world
I got given it as a child in the form of coffee.
atilaneves··on A new Go API for Protocol Buffers
> Compile time generic programming is not a replacement for runtime reflection.

Yes, it is, especially since the former can be used to implement the latter.

atilaneves··on Want to call C from Python? Use D
> 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-specific code to access or return Python objects or act in a pythonic way.

Except, and I cannot stress this enough, at work we're using this to succesfully call into D production code without any Python-specific anything. It just works. The article wasn't even about that, it's about making it work just as seamlessly for C.

atilaneves··on Want to call C from Python? Use D
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 interested in an alias.
atilaneves··on Want to call C from Python? Use D
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 valid C code. I can't read the headers (separately!) and pass that in either because it can't handle preprocessor directives. It's a mess.

In the article, I do this:

``` #include "nanomsg/nn.h" #include "nanomsg/pipeline.h" ```

That's it. I don't think the approaches can be compared.

atilaneves··on Want to call C from Python? Use D
So just like the article describes.
atilaneves··on Want to call C from Python? Use D
There's no way to parse headers without a compiler.
atilaneves··on Want to call C from Python? Use D
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".

atilaneves··on Want to call C from Python? Use D
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.
atilaneves··on Want to call C from Python? Use D
That already works with Python, Excel and C# now. There's a link in the blog post to another blog post to that effect.
atilaneves··on Want to call C from Python? Use D
Literally all of it.
atilaneves··on Want to call C from Python? Use D
While nice, one still has to manually declare a Nim proc and tell it whence it came from. That's not the same.
atilaneves··on Want to call C from Python? Use D
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 was never meant for consumption from another language can be made available.

atilaneves··on Want to call C from Python? Use D
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.
atilaneves··on Want to call C from Python? Use D
I used swig once. Never again.
atilaneves··on Want to call C from Python? Use D
> 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 openoffice

Where I work, and in many many other places, it's all Excel. It's actually the most used programming language in the world. Maybe it shouldn't be, but it is.

atilaneves··on Want to call C from Python? Use D
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 could be easier".
atilaneves··on Want to call C from Python? Use D
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...).
atilaneves··on Want to call C from Python? Use D
> 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 it's a very interesting exploration of the subject.

Python was an example. Want to call it from C# instead? Same code. Excel? Same code.

atilaneves··on Want to call C from Python? Use D
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's preprocessor macros.

I don't know how Zig does it, I'd have to look.

I expand on why dpp is the way it is in my DConf 2019 talk: https://www.youtube.com/watch?v=79COPHF3TnE&t=8s

atilaneves··on Want to call C from Python? Use D
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?
atilaneves··on Want to call C from Python? Use D
I describe how easy it is to call C code from Python by using D as the glue layer. AMA.
atilaneves··on Becoming a high performing software developer working from your bedroom
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.
atilaneves··on Zero-days in Cisco Discovery Protocol
> 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.

atilaneves··on Zero-days in Cisco Discovery Protocol
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.
atilaneves··on Zero-days in Cisco Discovery Protocol
> 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 works at all.

atilaneves··on Go's Tooling Is an Undervalued Technology
... 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 other language has package management so that's not a point in Go's favour.

From the article, we're left with compilation speed. That's actually important, but Go isn't the only language that has a reference compiler that runs fast!

atilaneves··on Go's Tooling Is an Undervalued Technology
Why would you?
← PreviousPage 2 of 8Next →