poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] std.pk: Add `get_mem_handle`


From: Jose E. Marchesi
Subject: Re: [PATCH] std.pk: Add `get_mem_handle`
Date: Sun, 10 Apr 2022 01:54:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> 2022-04-09  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
>>
>>      * libpoke/std.pk (get_mem_handle): New function to get a new
>>      unique handle for memory IOS.
>>      (__Pk_MemHandle_Generator): New implementation-specific type.
>> ---
>>
>> Hello.
>>
>> This can be useful for `with_cur_ios`:
>>
>> ```poke
>> type void_lambda = () void;
>> fun with_cur_ios = (void_lambda callback = lambda void: {},
>>                     string handle = get_mem_handle) void:
>>   {
>>     /* ... */
>>   }
>> ```
>>
>> WDYT?
>
> Hmmm.  The fact the HANDLE arguments comes last is not that nice.
>
> What about if we had an additional function `with_temp_ios' that would
> internally use the mechanism you propose?  Something like:
>
> fun with_temp_ios = (void_lambda callback) void:
> {
>   ... open (get_mem_handle) ...
> }

Actually that would be:

fun with_temp_ios = (void_lambda callback) void:
{
  with_cur_ios (get_mem_handle, callback);
}

>
> This would be complementary to with_cur_ios:
>
> fun with_cur_ios = (string handler, void_lambda callback) void:
> {
>  ...
> }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]