Displaying 7 results from an estimated 7 matches for "depcach".
Did you mean:
depcache
2024 Jan 18
1
Choices to remove `srcref` (and its buddies) when serializing objects
...ancillary source reference and sexpinfo.
I can show how this can be done, but it's not currently on CRAN or even
a well-defined package API. I have adapted a copy of R's serialize()
[*] with the following changes:
* Function bytecode and flags are ignored:
f <- function() invisible()
depcache:::hash(f, 2) # This is plain FNV1a-64 of serialize() output
# [1] "9b7a1af5468deba4"
.Call(depcache:::C_hash2, f) # This is the new hash
[1] 91 5f b8 a1 b0 6b cb 40
f() # called once: function gets the MAYBEJIT_MASK flag
depcache:::hash(f, 2)
# [1] "7d30e05546e7a230"
.Call(depc...
2024 Jan 18
1
[External] Re: Choices to remove `srcref` (and its buddies) when serializing objects
...>
> I can show how this can be done, but it's not currently on CRAN or even
> a well-defined package API. I have adapted a copy of R's serialize()
> [*] with the following changes:
>
> * Function bytecode and flags are ignored:
>
> f <- function() invisible()
> depcache:::hash(f, 2) # This is plain FNV1a-64 of serialize() output
> # [1] "9b7a1af5468deba4"
> .Call(depcache:::C_hash2, f) # This is the new hash
> [1] 91 5f b8 a1 b0 6b cb 40
> f() # called once: function gets the MAYBEJIT_MASK flag
> depcache:::hash(f, 2)
> # [1] "7d3...
2024 Jan 16
2
Choices to remove `srcref` (and its buddies) when serializing objects
Could you recommend any packages/functions that compute hash such that the source references and sexpinfo_struct are ignored? Basically a version of `serialize` that convert R objects to raw without storing the ancillary source reference and sexpinfo.
I think most people would think of `digest` but that package uses `serialize` (see discussion
2023 Mar 30
1
removeSource() vs. function literals
Dear R-devel,
In a package of mine, I use removeSource on expression objects in order
to make expressions that are semantically the same serialize to the
same byte sequences:
https://github.com/cran/depcache/blob/854d68a/R/fixup.R#L8-L34
Today I learned that expressions containing function definitions also
contain the source references for the functions, not as an attribute,
but as a separate argument to the `function` call:
str(quote(function() NULL)[[4]])
# 'srcref' int [1:8] 1 11 1 25 11...
2023 Mar 31
2
removeSource() vs. function literals
...; On 30/03/2023 10:32 a.m., Ivan Krylov wrote:
>> Dear R-devel,
>>
>> In a package of mine, I use removeSource on expression objects in order
>> to make expressions that are semantically the same serialize to the
>> same byte sequences:
>> https://github.com/cran/depcache/blob/854d68a/R/fixup.R#L8-L34
>>
>> Today I learned that expressions containing function definitions also
>> contain the source references for the functions, not as an attribute,
>> but as a separate argument to the `function` call:
>>
>> str(quote(function() NU...
2023 Mar 30
2
removeSource() vs. function literals
On 30/03/2023 10:32 a.m., Ivan Krylov wrote:
> Dear R-devel,
>
> In a package of mine, I use removeSource on expression objects in order
> to make expressions that are semantically the same serialize to the
> same byte sequences:
> https://github.com/cran/depcache/blob/854d68a/R/fixup.R#L8-L34
>
> Today I learned that expressions containing function definitions also
> contain the source references for the functions, not as an attribute,
> but as a separate argument to the `function` call:
>
> str(quote(function() NULL)[[4]])
> # '...
2024 Jan 12
2
Choices to remove `srcref` (and its buddies) when serializing objects
Dear R devs,
I was digging into a package issue today when I realized R serialize function not always generate the same results on equivalent objects when users choose to run differently. For example, the following code
serialize(with(new.env(), { function(){} }), NULL, TRUE)
generates different results when I copy-paste into console vs when I use ctrl+shift+enter to source the file in RStudio.