HNHacker News
TopNewBestAskShowJobs

bakery2k

433 karma · joined June 6, 2016

submissionscomments
bakery2k··on What Spectre and Meltdown Mean for WebKit
Mitigations for Spectre and Meltdown are also being added to the JavaScript VMs in Chrome [1], Firefox [2] and IE/Edge [3].

Are similar mitigations also needed in the VMs for other dynamic languages, such as CPython/PyPy, Ruby MRI and Lua/LuaJIT? What about the JVM and Microsoft's CLR?

Or are these other VMs not susceptible to this form of attack?

[1] https://www.chromium.org/Home/chromium-security/ssca

[2] https://blog.mozilla.org/security/2018/01/03/mitigations-lan...

[3] https://blogs.windows.com/msedgedev/2018/01/03/speculative-e...

bakery2k··on Ruby 3x3 Progress
Really interested to see what approach Ruby takes when it comes to typing support. Matz has said that "optional typing should honor duck typing" [1], which will require a very different approach to the simple nominal typing that's been added to recent versions of Python.

[1] https://bugs.ruby-lang.org/issues/5583#note-7

bakery2k··on Going beyond the idiomatic Python
> "!" for modifying functions in place

I think that consistently using "!" to mean "mutates in-place" would be a good convention for a language to use, but that's not what Ruby does. From Matz himself [1]:

The bang (!) does not mean "destructive" nor lack of it mean non destructive either. The bang sign means "the bang version is more dangerous than its non bang counterpart; handle with care". Since Ruby has a lot of "destructive" methods, if bang signs follow your opinion, every Ruby program would be full of bangs, thus ugly.

[1] https://www.ruby-forum.com/topic/176830#773946

bakery2k··on Ask HN: Would you recommend sharing code between an in-browser app and a CLI tool?
Are there tools for Node.js that can create standalone command-line apps? Can you recommend any in particular?
bakery2k··on MoonScript, a programmer friendly language that compiles to Lua
fixing the gaps in Lua. Moonscript's [...] default local

Roberto Ierusalimschy, the creator of Lua, believes that "Local by default is wrong." [1].

I don't necessarily agree that local-by-default is inherently wrong, but every implementation of local-by-default that I've seen has had flaws.

It looks like MoonScript is no different - its scoping rules seem to suffer from the same "madness" as CoffeeScript [2].

[1] http://lua-users.org/wiki/LocalByDefault

[2] https://donatstudios.com/CoffeeScript-Madness

bakery2k··on Swift: Close to greatness in programming language design (Part 1 of 3)
Part 2: https://www.synopsys.com/blogs/software-security/swift-progr...

Part 3: https://www.synopsys.com/blogs/software-security/swift-progr...

bakery2k··on Show HN: 15-question programming quiz with answers
0-256 not sure about negatives

-5 to 256 (inclusive) [https://github.com/python/cpython/blob/master/Objects/longob...]

bakery2k··on Show HN: 15-question programming quiz with answers
0 to 256 if I recall right

-5 to 256 (inclusive) [https://github.com/python/cpython/blob/master/Objects/longob...]

bakery2k··on LuaJIT 2.0.5 and 2.1.0-beta3 released
Looking at the LuaJIT changelog [1], it's interesting how many bugs need fixing in each version: 20 in 2.0.5 and 32 in 2.0.4.

Compare this with PUC Lua [2], which seems to have very few bugs: only 4 in 5.3.3 and 3 in 5.3.2.

LuaJIT and PUC Lua appear to be very similar superficially ("LuaJIT is Lua, but fast"). The relative bug counts reinforce the fact that in the details, the two implementations are very different - for example, LuaJIT uses a lot of assembly language while PUC Lua is pure C89.

The advantages of LuaJIT over PUC Lua seem to be performance and its FFI. I thought PUC Lua's only advantage was portability, but perhaps PUC Lua is also a generally more "correct" implementation?

[1] http://luajit.org/changes.html

[2] https://www.lua.org/bugs.html

bakery2k··on My love-hate relationship with LuaJIT (2015)
Doesn't that also use a JIT?

YARV? No.

YARV is the current official Ruby interpreter - it replaced MRI in this role from Ruby 1.9 onwards.

bakery2k··on My love-hate relationship with LuaJIT (2015)
You're talking about Ruby MRI?

Not the original MRI, but YARV. For this particular program, the performance of different language interpreters is:

MRI (Ruby 1.8) < CPython 3.5 < CPython 2.7, PUC Lua 5.1/5.3 < YARV (Ruby 1.9/2.3) < LuaJIT -joff

There is a factor of ~5x between the slowest and fastest of these interpreters. LuaJIT with the JIT enabled is ~10x faster than even its own interpreter.

bakery2k··on My love-hate relationship with LuaJIT (2015)
In the last year bugs have been fixed almost instantly

That's good to hear. Perhaps LuaJIT isn't "unsupported", but it does seem to be "in maintenance mode".

I would love to see, not just bug fixes to LuaJIT, but ongoing improvements. Unfortunately with Mike having stepped down, and there being no successor, nobody is making these improvements and nobody is driving the project forward.

For example, will the new garbage collector [1] ever be implemented? Will LuaJIT remain stuck at version 5.1 while PUC Lua continues to add new features?

[1]: http://wiki.luajit.org/New-Garbage-Collector

bakery2k··on My love-hate relationship with LuaJIT (2015)
In my experience (doing some fairly heavy computation in nested loops), PUC Lua is faster than Python but slower than recent versions of Ruby.

LuaJIT is at least 10x faster than all three.

bakery2k··on Python JITs are coming
I actually wrote a Julia version at the time, but it was difficult to accurately benchmark because the total runtime was significantly affected by a long (~5 seconds) delay at startup.

Recently, however, I came across https://www.reddit.com/r/Julia/comments/4c09m1/, which suggests running with `--precompiled=yes` to reduce startup time. I have now run the Julia version with that command-line option, and the runtime is impressive - comparable to C#/Go/V8.

bakery2k··on Python JITs are coming
An example of how, for certain types of code, more than an order-of-magnitude performance improvement can be obtained with a good JIT compiler. I wrote a decompression routine (for a simple compression format) in several languages - it took the following lengths of time to run (normalized to C++ = 1 second):

* CPython, Jython, Lua, MicroPython, Ruby (1.8): >100 seconds

* Cython (naive), IronPython, Ruby (2.3): 50 - 80 seconds

* LuaJIT, PyPy, Cython (with type hints): ~4 seconds

* C#, Go, JavaScript (V8): ~1.5 seconds

bakery2k··on PEP 526: Variable declaration in Python
Where can we voice our opposition to this?

https://github.com/python/typing/issues/258

bakery2k··on Ask HN: Which parts of C++ do I need to learn in order to use Qt?
I considered using one of these libraries and writing the Qt GUI for my application in Python rather than C++.

However, I would like to build the application into a standalone binary for end-users to run on their own systems. This seems to be difficult with Python, and when I was able to build such a binary (using PyInstaller on Windows) it was large and slow to start-up.

(Qt itself is ~10MB (QtCore4.dll + QtGui4.dll) and (when using C++) can be made smaller by static linking, but PyQt doubles the size (python27.dll + PyQt4.QtCore.pyd + PyQt4.QtGui.pyd).)

bakery2k··on Ask HN: Which parts of C++ do I need to learn in order to use Qt?
Thanks for your reply. What little C++ experience I have is from several years ago - do you think (again, purely in the context of Qt) that any of the new C++11 features are worth using or should I stick to C++98?
bakery2k··on The Rust Platform
Docker, for example, say "seriously just don't use it".

http://www.slideshare.net/jpetazzo/docker-and-go-why-did-we-...

bakery2k··on Asciinema 1.3 Switches from Go Back to Python
To clarify, I'm not necessarily looking for something "extremely popular". I was using the fact that so many people consider Python to be their favorite language as a proxy for the high quality of the language design. Perhaps "popular" was the wrong word?

So, thank you for listing some less-popular languages as well. Unfortunately, of all 8 languages listed in your post, is C++ the only one which can produce standalone binaries and thus match the easy deployment of Go?

bakery2k··on Asciinema 1.3 Switches from Go Back to Python
> flag's capabilities are so limited

It's a shame Go's flag package is so poor. Even Docker, who seem to be hugely invested in Go, say "seriously just don't use it". [1]

[1] http://www.slideshare.net/jpetazzo/docker-and-go-why-did-we-...

bakery2k··on Asciinema 1.3 Switches from Go Back to Python
It seems to me that Go has very useful runtime features (speed, concurrency & parallelism, easy deployment) but the language has significant drawbacks, including those listed in this article.

The Python runtime is relatively poor (slow and limited by the GIL) but the language is extremely popular [1].

Is there any other language which is a "best of both"?

[1] https://news.ycombinator.com/item?id=3746692

bakery2k··on Designing Sane Scoping Rules
These rules are essentially a simplification (`global` keyword removed) of those used in Python 3. They may be the simplest rules possible without requiring variable declarations, but they have a couple of problems:

1. A typo on the LHS of an assignment will create a new variable rather than being flagged as an error.

2. There is no way to create variables which are local to the current block, for example, the body of a loop.

bakery2k··on Squirrel Programming Language
Interesting that hajile and you both dislike global-by-default, but your proposed alternatives are essentially opposites. hajile would prefer local-by-default and fewer declarations, and you would prefer nothing-by-default and more declarations...
bakery2k··on Squirrel Programming Language
Presumably the author of Squirrel agrees with (one of) the authors of Lua: "Local by default is wrong" [1].

"The problem is that without local declarations, you cannot say where the variable is local to" [2]. Take Python, for example, where "local by default" means "local to the current function". Variables are created in the current function's scope on assignment, which causes 2 problems:

1. It is awkward to modify variables in outer scopes, because an attempt to assign to them creates a new variable. Python works around this with the `global` and `nonlocal` keywords.

2. Python does not support variables which are local to the current block, for example, the body of a loop.

[1] http://lua-users.org/lists/lua-l/2006-10/msg00056.html [2] http://lua-users.org/lists/lua-l/2006-10/msg00063.html

bakery2k··on Why is Python slow
Part of the problem with Python is (that Lua doesn't share) is that things you use all the time can potentially shift between two loop iterations

Why is this problem not shared by Lua? Does Lua somehow prevent "process_file" from modifying the equivalent of "os.path"?

bakery2k··on Why is Python slow
>> Part of the problem with Python is (that Lua doesn't share) is that things you use all the time can potentially shift between two loop iterations, e.g.

    for x in os.listdir(PATH):
        y = os.path.join(PATH, x)
        process_file(y)
>> There is no guarantee that "os.path" (and thus "os.path.join") called by one iteration is the same one called by the next iteration - process_file() might have modified it.

> LuaJIT also gets serious wins from lifting the lookups out of loops since they can't change. This is only due to the fact that Lua doesn't have threads that can muck with each other's state.

Would Lua code equivalent to the above Python have the same problem - that "process_file" could modify the value of "os.path"? Would this prevent LuaJIT from hoisting the lookup out of the loop, even in the absence of threads?

bakery2k··on Ask HN: What is the Unique Selling Point of each programming language?
JavaScript is interesting because the language itself may not have a Unique Selling Point. Its most important feature is its ubiquity, a property of its ecosystem.
bakery2k··on David Beazley – Python Concurrency from the Ground Up: Live – PyCon 2015
Does anyone know the details behind what happens to the thread-based server at 11:30? The response time for small requests "drops off a cliff" due to a single large request, apparently due to "the implementation of the GIL"?

Compared to the simple thread-based server, the generator-based server presented in the second half of the talk avoids the above problem. Does the generator-based approach have any other advantages?

bakery2k··on Removing Python's GIL: The Gilectomy [video]
I would certainly be interested to learn about better language and interpreter design.

Do you think anyone will ever use the lessons learned about interpreters and write a "better next time" implementation of Python, or do you only see an improved runtime appearing alongside a significantly different language?

← PreviousPage 4 of 5Next →