[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master fffd4ff: ; etc/TODO: Remove 'switch' item, as it is now imple
Re: master fffd4ff: ; etc/TODO: Remove 'switch' item, as it is now implemented.
Tue, 14 Feb 2017 11:52:34 +0530
On Tue, Feb 14, 2017 at 4:40 AM, Mark Oteiza <address@hidden> wrote:
> address@hidden (Vibhav Pant) writes:
>> diff --git a/etc/TODO b/etc/TODO
>> index fc442f9..b102bdf 100644
>> --- a/etc/TODO
>> +++ b/etc/TODO
>> @@ -35,20 +35,6 @@ Change src/bytecode.c so that calls from byte-code
>> functions to byte-code
>> functions don't go through Ffuncall/funcall_lambda/exec_byte_code but
>> stay within exec_byte_code.
>> -** Add new 'switch' byte-code
>> -This byte-code would take one argument from the stack (the object to test)
>> -and one argument from the constant-pool (a switch table, implemented as an
>> -'eq' hash table) and would jump to the "label" contained in the hash table.
>> -Then add a 'case' special-form that can be compiled to this byte-code.
>> -This would behave just like cl-case, but instead of expanding to cond+eq it
>> -would be its own special form and would be compiled specially.
>> -Then change pcase to use 'case' when applicable.
>> -Then change the byte-compiler to recognize (cond ((eq x 'foo) bar) ...)
>> -and turn it into a 'case' for more efficient execution.
> What about the second and third items?
Both pcase and cl-cond are macros that expand to a cond form,
so they also compile to switch bytecode.