Rvalue references

From the C++11 FAQ, section on rvalue references, about a simple incrementation function incr:

If that incr(0) were allowed either some temporary that nobody ever saw would be incremented or - far worse - the value of 0 would become 1. The latter sounds silly, but there was actually a bug like that in early Fortran compilers that set aside a memory location to hold the value 0.

That actually made me think about that nifty one-liner:

perl -wE 'Internals::SvREADONLY(${\undef},0);undef=42;say undef'

Perl documentation word clouds

This is totally useless, but I've written a script to create word clouds from perl's core pod files. As an example, here's the word cloud from perlunifaq : perlunifaq.png

Why Dart is not the language of the future

So I've been looking at the Dart language specification recently published by Google (draft version 0.01). So far, I'm not really enthusiastic. Here's my reading notes.

Class-based OO and Interfaces

At first glance Dart code looks like Java (and nothing's wrong with that, I'm not going to criticize a language based on my idiomatic preferences). The syntax is very similar, with the dot to invoke methods, the curly braces for blocks, the required semicolon to terminate statements, the main() function, the general feeling of verbosity. The familiar classes and interfaces are…

New Safe.pm fixes security hole

Safe.pm, originally released with perl 5.002, has been an experiment to bring compile-time safety to perl. It allows to compile a (usually user-provided) snippet of perl code and execute it, while forbidding a configurable list of operations -- for example, all perl built-ins that would require disk or operating system access. Moreover, Safe "chroots" perl's main:: namespace, so the real program's variables can't be overwritten by the ones created by the code executed from Safe.

It's pretty clear that Safe does not provide absolute safety. For once, even overly restricted, it can be a…

C, Perl, and cut and paste

On all released 5.10.* versions of Perl to date, the smart match operator can segfault if passed recursive data structures (like arrays that contain a reference to themselves). I fixed that. The fix was pretty trivial: basically, the C code in the implementation of smart match was creating two hashes, called seen_this and seen_other; however, a typo made it so only seen_this was actually created. Segfaults ensued if the code was trying to use seen_other. …