Recent submissions

Comment · 6 years ago
> what can you expect from a language that uses "+", the quintessential notation for commutative operations, for the (very non-commutative) operation of concatenation?

Is this any worse than using `+` for floating-point addition, which isn't even associative?

Comment · 6 years ago
So, Envoy will be embedding WebAssembly alongside (or instead of) Lua?

Are other projects moving from Lua (or other embedded scripting languages) to WebAssembly? What are the benefits of compiling an extension to WASM rather than writing it in Lua?

Comment · 6 years ago
Thanks, that makes sense.
Comment · 6 years ago
> It was released just as the PS2 was announced

I think that's the point. A lot of people bought a PS2 because it was also a DVD player (same with the PS3 and Blu-ray).

Comment · 6 years ago
Isn't code generation during parsing still common today? In particular, bytecode generation in interpreters (and JIT compilers) for scripting languages, e.g. Lua?
Comment · 6 years ago
`range` is an example. Lack of support for overloading makes it harder to replicate its API in our own functions.
Comment · 6 years ago
Well, however the `range` function is implemented, IMO its API would be better expressed as true overloading - as two functions with the same name.
Comment · 6 years ago
If all we do is write Pythonic code (especially now that "Pythonic" seems to include type hints), what's the benefit of the highly dynamic CPython virtual machine?

Surely a faster VM, or even an ahead-of-time compiler, would be possible if we give up on some dynamism? Is that a direction the community should take?

(I think Guido's answer would be no, based on his apparent dislike of existing "Python compiler" projects such as Nuitka.)

Comment · 6 years ago
`range(stop)` and `range(1, stop)` are both supported, but without overloading, the implementation of `range` is messy as it has to work out the meaning of each argument manually.
Comment · 6 years ago
That's the thing - it's documented as overloaded, because that's the most intuitive explanation. Wren would allow it to actually be implemented as an overloaded function.

Python doesn't support overloading, and it doesn't support optional arguments before required ones, so the actual implementation in Python is a bit messy - something like:

  def range(start_or_stop, optional_stop=None):
      if optional_stop is None:
          start = 0
          stop = start_or_stop
      else:
          start = start_or_stop
          stop = optional_stop
      ...
Comment · 6 years ago
Comment · 6 years ago
"Distances longer than a few kilometers are measured in miles" was a direct reference to the OP's "yards to measure distances shorter than a few kilometers".
Comment · 6 years ago
I think Jedd was commenting on the spelling of "meter" vs "metre".

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton