HN user

atilaneves

692 karma
Posts22
Comments233
View on HN
atilaoncode.blog 6y ago

Want to call C from Python? Use D

atilaneves
193pts112
atilaoncode.blog 7y ago

Type inference debate: a C++ phenomenon?

atilaneves
1pts2
atilaoncode.blog 7y ago

Build Systems Are Stupid

atilaneves
7pts2
atilaoncode.blog 7y ago

When you can't (and shouldn't) unit test

atilaneves
2pts1
atilanevesoncode.wordpress.com 7y ago

Comparing Pythagorean triples in C++, D, and Rust

atilaneves
135pts116
atilanevesoncode.wordpress.com 7y ago

Unit testing? Do as I say, don't do as I do

atilaneves
2pts1
atilanevesoncode.wordpress.com 7y ago

Libclang: not as great as I thought

atilaneves
3pts0
atilanevesoncode.wordpress.com 7y ago

Implementing Rust’s std::sync::Mutex in D

atilaneves
5pts1
atilanevesoncode.wordpress.com 8y ago

Myths programmers believe

atilaneves
8pts7
atilanevesoncode.wordpress.com 8y ago

Include C headers in D code

atilaneves
20pts8
atilanevesoncode.wordpress.com 10y ago

Rust impressions from a C++/D programmer

atilaneves
8pts0
www.youtube.com 10y ago

CppCon 2015: Emacs as a C++ IDE

atilaneves
5pts1
atilanevesoncode.wordpress.com 10y ago

Haskell: unexpectedly making it harder to unit test

atilaneves
4pts0
atilanevesoncode.wordpress.com 10y ago

Line coverage isn't as important as most people think

atilaneves
1pts0
atilanevesoncode.wordpress.com 10y ago

Cerealed: a library for declarative binary serialization

atilaneves
5pts0
atilanevesoncode.wordpress.com 11y ago

Valgrind-driven development

atilaneves
2pts0
www.youtube.com 11y ago

Behaviour-Driven Development with D and Cucumber (DConf 2015)

atilaneves
3pts1
atilanevesoncode.wordpress.com 11y ago

The importance of making the test fail

atilaneves
1pts0
atilanevesoncode.wordpress.com 11y ago

Ropemacs for Python 3: Emacs as a Modern Python IDE

atilaneves
2pts0
atilanevesoncode.wordpress.com 11y ago

Type safety and time intervals in D and Go

atilaneves
2pts0
atilanevesoncode.wordpress.com 12y ago

To learn BDD with Cucumber, you must first learn BDD with Cucumber

atilaneves
2pts0
atilanevesoncode.wordpress.com 12y ago

Increasing performance with static polymorphism (and other neat tricks) in D

atilaneves
12pts5

No, you can just write D. It'll have the same performance as C, if you write C-like code. It might have better performance than C if you use templates (just like in C++).

Because it is also possible to write tests that don't adequately capture real-life requirements.

It was an MQTT server, and the tests basically went "if we have these subscriptions, then...", but no subscriptions ever got actually stored by the server.

I hear this about both Haskell and Rust, and yet, when I tried both in the former I wrote a useless program because I didn't handle state (and yet passed all tests!) while in the latter I immediately wrote a deadlock.

So...yeah.

Wouldn't the instance state here be "was constructed"? That is: you should always be able to call `Read` because the constructor opened the file, and you shouldn't have to call `Close` anyway because the destructor did.

What do you think, is there a potential niche for like NeoEmacs, a test editor written in a modern Lisp / Scheme

I think that's a non-starter because you instantly lose the entire ecosystem of elisp packages out there and nobody's config would work anymore. The latter is especially important when for some people that's a decades-developed init.el file in a repo that's migrated from CVS to subversion then git.

I've git bisected (mercurial at the time, but whatever) my .emacs repo to figure out what I did to break my Python config, so there's that.

If the array fits in the cache, deleting from the middle of an array and copying all the subsequent elements one to the left is actually faster than a linked list.

And most arrays fit in the cache.

1. That's a rare use case 2. There are ways of measuring that without hampering readability. I mean, are programmers supposed to add all the variables' sizes up in their head??

Source code is for humans

The reason why making the scope as local as possible is important is for humans, not compilers.

Put all the vars at the top to tell the humans "here's all the scratch space I'll be needing in this block"

Why would humans care about how much scratch space is needed? That's for the compiler to know.

> It takes an input range Which should have a type.

It does. That'd the `Range` here: https://dlang.org/phobos/std_algorithm_iteration.html#.map.m...

> and returns a type that iterates through that range Which should have a type.

It does. But the name of that type depends on the type of the range and on the callable.

Functor f => (a -> b) -> f a -> f b

This doesn't work because the return type isn't `f b`, it's `g b` where g depends on what f is. It also depends on the callable, because the first parameter isn't necessary a function. The closest is

Callable c, Range r0 => c a b -> r0 a -> r1 b

Where `r1` isn't even a concrete type but a type that depends on both `c` and `r0` and is made up on-the-fly (per instantiation).

Documentation is good.

I agree. How would you suggest improving the signature of map given that D doesn't have typeclasses? Or with types that depend on other types in the template?

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.

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.