enum Vala(uint count, alias arr) = format("
asm {
sub ESP, %d; // Reserve 'count' bytes
mov %s, %d; // Set a.length = 'count'
mov %s + 4, ESP; // Set &a[0] to reserved bytes
}", count, arr.stringof, count, arr.stringof);
I'd like to write that more like this:
enum Vala(uint count, alias arr) = format("
asm {
sub ESP, %%(count); // Reserve 'count' bytes
mov %%(arr.stringof), %%(count); // Set a.length = 'count'
mov %%(arr.stringof) + 4, ESP; // Set &a[0] to reserved
bytes
}");
See:
http://fslang.uservoice.com/forums/245727-f-language/suggestions/6002107-steal-nice-println-syntax-from-swift
Bye,
bearophile