HackerTrans
TopNewTrendsCommentsPastAskShowJobs

pansa2

4,068 karmajoined 6 tahun yang lalu

Submissions

Proposal: Generic Methods for Go

github.com
1 points·by pansa2·6 bulan yang lalu·0 comments

The many advantages of dynamic languages (2020)

erik-engheim.medium.com
8 points·by pansa2·6 bulan yang lalu·0 comments

Pre-PEP: Rust for CPython

discuss.python.org
2 points·by pansa2·8 bulan yang lalu·0 comments

Ruby 4.0.0 Preview2

ruby-lang.org
199 points·by pansa2·8 bulan yang lalu·89 comments

Why every Rust crate feels like a research paper on abstraction

daymare.net
59 points·by pansa2·9 bulan yang lalu·50 comments

comments

pansa2
·6 hari yang lalu·discuss
I always liked the fact that 10! (10 factorial) is exactly the number of seconds in six weeks.

  6 weeks * 7 days * 24 hours * 60 minutes * 60 seconds:

    6 * 7 * 24 * 60 * 60
  = 6 * 7 * (3 * 8) * (4 * 5 * 3) * (3 * 2 * 10)
  = 6 * 7 * 3 * 8 * 4 * 5 * (3 * 3) * 2 * 10
  = 6 * 7 * 3 * 8 * 4 * 5 * 9 * 2 * 10
  = 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10
pansa2
·14 hari yang lalu·discuss
What’s a good small laptop that’ll run a recent Linux distro? I’d like to get one to have an ultra-portable machine for doing lightweight development work - I don’t need much more than a text editor and a C compiler.

Would a second-hand 11” MacBook Air or 12” MacBook be a good choice?
pansa2
·16 hari yang lalu·discuss
So is LuaJIT resuming active development after a decade or so of only maintenance? Great!

A lot of these changes make sense (although some of them are a bit too TIMTOWTDI for my taste) - but perhaps LuaJIT 3 would benefit from a change of name as well? Certainly with all these changes, it would be more like a separate language than merely a JIT-compiled version of Lua.
pansa2
·bulan lalu·discuss
Lua is the same IIRC: open source but not open development.

It’s MIT licensed, and the maintainers are always grateful for bug reports, but all the code in the project was written by just 3 people.
pansa2
·bulan lalu·discuss
> The C interface to ruby is just superb.

How does it handle garbage collection? AFAIK GC is the main reason behind Lua's stack-based API: it's designed so that C code never needs to hold a pointer to a Lua object, which means an object will never be garbage-collected while C code is still trying to use it.

OTOH Python does allow C code to hold such pointers - so it requires that code to perform error-prone manual reference-counting.

How does Ruby solve this problem?
pansa2
·bulan lalu·discuss
I guess it alludes to “The Dark Side of the Moon”
pansa2
·2 bulan yang lalu·discuss
Mojo?
pansa2
·2 bulan yang lalu·discuss
`npm isntall`
pansa2
·2 bulan yang lalu·discuss
> they intended to make it compatible with existing Python code

That was the original claim, but it was quietly removed from the website. (Did they fall for the common “Python is a simple language” misconception?).

Now they promise I can “write like Python”, but don’t even support fundamentals like classes (which are part of stage 3 of the roadmap, but they’re still working on stage 1).

Maybe Mojo will achieve all its goals, but so far has been over-promising and under-delivering - it’s starting to remind me of the V language.
pansa2
·2 bulan yang lalu·discuss
> New Zealanders are forced to pay a sky high TV licence

There’s no TV license in New Zealand
pansa2
·2 bulan yang lalu·discuss
The PEP for this change is here [0] and discussion of it is here [1]. Both are very long and seem to represent a huge amount of complexity, apparently to make installing Python easier for novices?

But what about those of us who listened to Rich Hickey and prefer "simple" over "easy"? With the executable installer no longer available, how do I get a copy of python.exe, python316.dll etc onto my machine so that `C:\Python316\python.exe <script>` works, without having to think about `py`, `pymanager`, Windows Store etc?

[0] https://peps.python.org/pep-0773/

[1] https://discuss.python.org/t/pep-773-a-python-installation-m...
pansa2
·3 bulan yang lalu·discuss
In a similar vein, see this page about the performance of the interpreter for the dynamic language Wren: https://wren.io/performance.html

Unlike the Zef article, which describes implementation techniques, the Wren page also shows ways in which language design can contribute to performance.

In particular, Wren gives up dynamic object shapes, which enables copy-down inheritance and substantially simplifies (and hence accelerates) method lookup. Personally I think that’s a good trade-off - how often have you really needed to add a method to a class after construction?
pansa2
·3 bulan yang lalu·discuss
Yes, Smalltalk's syntax fits on a postcard - and it's possible to go even more minimal than that, e.g. Lisp or Forth.

OTOH Ruby doesn't need a postcard, it needs a full poster.
pansa2
·4 bulan yang lalu·discuss
> all the encoding/decoding functions default to utf-8

Languages that use UTF-8 natively don't need those functions at all. And the ones in Python aren't trivial - see, for example, `surrogateescape`.

As the sibling comment says, the only benefit of all this encoding/decoding is that it allows strings to support constant-time indexing of code points, which isn't something that's commonly needed.
pansa2
·4 bulan yang lalu·discuss
> Wouldn't this get the funding back?

The funding was Microsoft employing most of the team. They were laid off (or at least, moved onto different projects), apparently because they weren't working on AI.
pansa2
·4 bulan yang lalu·discuss
The Python devs didn’t want to make huge changes because they were worried Python 3 would end up taking forever like Perl 6. Instead they went to the other extreme and broke everyone’s code for trivial reasons and minimal benefit, which meant no-one wanted to upgrade.

Even the main driver for Python 3, the bytes-Unicode split, has unfortunately turned out to be sub-optimal. Python essentially bet on UTF-32 (with space-saving optimisations), while everyone else has chosen UTF-8.
pansa2
·4 bulan yang lalu·discuss
Maybe they could have two versions of the interpreter, one that’s thread-safe and one that’s optimised for single-threading?

Microsoft used to do this for their C runtime library.
pansa2
·4 bulan yang lalu·discuss
There isn’t a dev mailing list any more, is there? Do you mean the Discord forum?
pansa2
·4 bulan yang lalu·discuss
>> Python 2->3 transition

> taking backwards compatibility so seriously

Python’s backward compatibility story still isn’t great compared to things like the Go 1.x compatibility promise, and languages with formal specs like JS and C.

The Python devs still make breaking changes, they’ve just learned not to update the major version number when they do so.
pansa2
·4 bulan yang lalu·discuss
Crystal’s syntax is similar to Ruby’s, but AFAIK the similarity more-or-less ends there.