Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pansa2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
33 ms
·
481.
▲
by
pansa2
4y ago
“She’ll be right”, meaning “it’ll be OK” describes one of the ways in which life in Australia and New Zealand differs from, say, the UK. It manifests in two ways: - “It’ll be OK, don’t worry about it”, which leads to a more relaxed, less bu
482.
▲
by
pansa2
5y ago
> Minimalist dependency injection in Python When an object requires other objects for its work, pass references to those other objects into its __init__ method. That’s it.
483.
▲
by
pansa2
5y ago
`Token` isn’t a type that a parser has to define - it comes from the previous stage (the lexer), or could even just be `string`. When writing a parser it’s already defined - so do you start the parser by working with the types you already h
484.
▲
by
pansa2
5y ago
I feel that this hints at a fundamental division between two ways that different programmers approach problems. I’m the opposite to you - I tend to think logic-first. So, for example, when thinking about a parser I’d start by writing code t
485.
▲
by
pansa2
5y ago
> I used generics as an exercise: for a circular buffer [1] is that ok? I’d say that’s an example of “type parameters can be useful for general purpose data structures”.
486.
▲
by
pansa2
5y ago
What’s “devirtualization” in this context?
487.
▲
by
pansa2
5y ago
Yes, Lua’s now on version 5.4 and LuaJIT is stuck half-way between 5.1 and 5.2.
488.
▲
by
pansa2
5y ago
Lua 5.3’s not really a fork. It just has backwards-incompatible changes, as do 5.1, 5.2 and 5.4. Otherwise yes, “Fengari implements Lua 5.3”. https://github.com/fengari-lua/fengari
489.
▲
by
pansa2
5y ago
Not OP, but for me, I love Lua because it’s both easy-to-use and simple. Python is the former and Go is the latter, but I don’t know any other mainstream language that’s both.
490.
▲
by
pansa2
5y ago
> These days no popular language, not even scripting ones, interprets byte code upon execution. Python does. At least, the CPython implementation does, and that’s what 99% of Python code runs on.
491.
▲
by
pansa2
5y ago
> we want Lua to be the language we want it to be, not to be the most popular language in the world I don’t agree with all the design decisions made by the Lua team, but I deeply respect this philosophy. It’s clear that Lua has certain
492.
▲
by
pansa2
5y ago
That’s right - but if you don’t use `-—onefile` you don’t really have a “stand-alone executable” at all.
493.
▲
by
pansa2
5y ago
How well does C# work for this cross-platform? Are its executables very large? I considered using Go for command-line apps - but in my case they often have to interact with existing C++ code. That’s easy enough to do from Python, but I was
494.
▲
by
pansa2
5y ago
IIRC a big issue with PyInstaller is that the built executables are really self-extracting archives, which have to write many files to disk before they can run. Compared to a real compiled executable, it’s slow and inelegant. Unfortunately
495.
▲
by
pansa2
5y ago
I guess that would be prohibitively large for some uses. I’d expect MicroPython (or Lua/mruby/etc) could be an order of magnitude smaller. Still larger (and slower) than just using JavaScript, though.
496.
▲
by
pansa2
5y ago
I imagine the biggest downside of this approach is simply the size of the CPython implementation. Does anyone know how big it is when compiled to WASM? I wonder if anyone has tried the same approach using MicroPython.
497.
▲
by
pansa2
5y ago
See "Running Python in the Browser" [0] - I believe this approach is similar to Pyodide's. [0] https://yasoob.me/2019/05/22/running-python-in-the-browser/
498.
▲
by
pansa2
5y ago
Compared to UK plugs, the Australian pins are very thin and the earth pin is optional. This makes it easy to insert a plug at a slightly wrong angle and make electrical contact without the socket gripping the plug at all. Also the pins can
499.
▲
by
pansa2
5y ago
> dynamically checks that the type is correct How thorough is this? Beartype is also on the front page right now, and its README contains an example of dynamic type checking in Python that takes over an hour to run [0]. Is Toit able to
500.
▲
by
pansa2
5y ago
Thanks - the page is very focused on the ESP32, and I missed the "Build for Linux" section in the middle.
501.
▲
by
pansa2
5y ago
AFAIK some of the authors of Toit were involved in the optionally-typed Dart 1, but the statically-typed Dart 2 was designed by other people.
502.
▲
by
pansa2
5y ago
Is it possible to compile the code at https://github.com/toitlang/toit to run on a desktop? Are there instructions on how to make such a build?
503.
▲
by
pansa2
5y ago
You were able to compile Toit code direct to WASM? I guess that required using static types throughout? Or did you compile the VM to WASM instead, and interpret the Toit code as normal?
504.
▲
by
pansa2
5y ago
I think it's accurate, though. Far more people know Python and Ruby than Lua, but when it comes to embedding an interpreter in an application, nobody chooses the language subsets of MicroPython and mruby over the complete language of L
505.
▲
by
pansa2
5y ago
> more than 30x faster than MicroPython on an ESP32 Based on a quick look at the file “interpreter_run.cc”, Toit’s VM appears to be a stack-based interpreter like MicroPython’s. It would be interesting to know what techniques are being
506.
▲
by
pansa2
5y ago
> big software has to be formal to live longer and stay healthy Can’t disagree, but where are the languages for little software? For example, I write lots of small (100-1000 LoC) command-line tools. I’m not a full-time programmer, so
507.
▲
by
pansa2
5y ago
Then should the example in the above comment, `some_enum.collect(&:+)`, be using reduce instead of collect?
508.
▲
by
pansa2
5y ago
OK then, Lua. Or Python before type hints.
509.
▲
by
pansa2
5y ago
I’ve heard a lot of recommendations for this book from programming language designers - is it (and the subjects it covers) useful for everyday programmers (i.e. language users), or just for language designers? For the latter, I assume type
510.
▲
by
pansa2
5y ago
You still don’t need `>` for any of those examples though, do you? For example, `NULL > 1` could be rewritten as `1 < NULL` (even though it can’t be rewritten as `not(NULL <= 1)`.
More ›