News for hackers. Stuff that matters.

pansa

Re:Haskell Problems for a New Decade on Friday January 24, 2020 @09:42AM (#22138656)
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.

I was sure your link to a British comedian was going to be:

https://en.wikipedia.org/wiki/Tommy_Cooper

Doesn’t Python’s `import` evaluate code in the same way as Ruby’s `require`?
Re:Copying data is wasteful, mutating data is dangerous on Friday January 10, 2020 @02:32AM (#22009083)
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.

Re:Algorithm Removes Water from Underwater Images on Thursday January 09, 2020 @08:20AM (#22000930)
[deleted]
Wouldn’t reddish organic matter just be “red meat”? Or do you consider, for example, lamb to be a type of beef?
Re:Pattern Matching in Ruby 2.7 (2019) on Thursday January 09, 2020 @07:30AM (#22000621)
> 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)`.

Re:Pattern Matching in Ruby 2.7 (2019) on Thursday January 09, 2020 @07:20AM (#22000570)
> 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.

Re:Pattern Matching in Ruby 2.7 (2019) on Thursday January 09, 2020 @07:00AM (#22000468)
IIRC Guido himself is planning on adding a `match` statement to Python.
Re:Pattern Matching in Ruby 2.7 (2019) on Thursday January 09, 2020 @06:54AM (#22000432)
> 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.

Re:Pattern Matching in Ruby 2.7 (2019) on Thursday January 09, 2020 @06:40AM (#22000347)
> 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.

Re:People Who Are Obsessed with Success and Prestige on Tuesday January 07, 2020 @11:10AM (#21981278)
Did tech “barely exist” when Zuckerberg started Facebook in 2004?
Re:People Who Are Obsessed with Success and Prestige on Tuesday January 07, 2020 @08:58AM (#21979899)
> 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.