Recent submissions

Comment · 6 years ago
Julia is built around multiple dispatch - when making a call, the method to execute is chosen based on the run-time types of all of the arguments.

Once this choice has been made, Julia compiles the method, specialised for the exact types of the arguments.

So, the dispatch process and the JIT compiler are linked - both are reliant on type information every time a function is called.

This specialisation is the only way the Julia JIT uses runtime type information. Unlike JavaScript JITs, Julia does not track things like the types of local variables during execution (although it may do some static inference). Therefore type annotations for local variables can improve performance.

Comment · 6 years ago
Comment · 6 years ago
Doesn’t Python’s `import` evaluate code in the same way as Ruby’s `require`?
Comment · 6 years ago
There is some convention in Python - for example `reverse` and `sort` are mutating, whereas `reversed` and `sorted` are not.

However, I don’t know if there is a good reason why the mutating versions are methods and the non-mutating ones are standalone functions.

Comment · 6 years ago
[deleted]
Comment · 6 years ago
Wouldn’t reddish organic matter just be “red meat”? Or do you consider, for example, lamb to be a type of beef?
Comment · 6 years ago
> Genuinely curious, what makes Python look more like pseudocode? The use of colons?

I used to think it was significant indentation, but if you look at the pseudocode on e.g. Wikipedia, there is no significant preference for either whitespace or begin/end.

Therefore, it’s probably things like `if value in my_map` vs `if my_map.contains(value)` and `[x * 2 for x in my_list]` vs `my_list.map(x -> x * 2)`.

Comment · 6 years ago
> I am sure method_missing could be implemented in python using various tricks but nobody, afaik, is doing that.

You could probably implement method_missing in Python using either __getattribute__ or __getattr__.

I think this is a small example of why nobody is doing so. It’s not just culture - Python’s object model is so complex that it would be hard to get right.

> why don't people just write clear, explicit, maintainable code instead of trying to be clever

But that’s boring. Seriously, it always amazes me how many programmers allow their decisions to be guided by what’s best for their personal enjoyment rather than what’s best for the project.

Comment · 6 years ago
IIRC Guido himself is planning on adding a `match` statement to Python.
Comment · 6 years ago
> how would you showcase an experimental feature to the community?

How do other languages do it? Python has the PEP process for discussing design on paper, but I don’t know how they handle experimental implementations.

Comment · 6 years ago
> I’ll never understand how Python became the more widely appreciated language

IMO syntax is a major factor. Python looks like pseudocode, while Ruby looks like Perl.

Comment · 6 years ago
Did tech “barely exist” when Zuckerberg started Facebook in 2004?
Comment · 6 years ago
> A guy who [...] wants to be known as the creator of something.

I have this problem. I’m frequently distracted from doing what I want to do by ideas for things that I want to have done (and wouldn’t enjoy actually doing day-to-day).

The search for prestige is about the only reason to switch paths and start working on any of these ideas, but it’s hard to ignore.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton