Displaying 20 results from an estimated 1000 matches similar to: "Choices to remove `srcref` (and its buddies) when serializing objects"
2024 Jan 17
1
Choices to remove `srcref` (and its buddies) when serializing objects
> I think one could implement hashing on the fly without any
> serialization, similarly to how identical works, but I am not aware of
> any existing implementation
We have one in vctrs but it's not exported:
https://github.com/r-lib/vctrs/blob/main/src/hash.c
The main use is vectorised hashing:
```
# Non-vectorised
vctrs:::obj_hash(1:10)
#> [1] 1e 77 ce 48
# Vectorised
2024 Jan 17
1
Choices to remove `srcref` (and its buddies) when serializing objects
On 1/16/24 20:16, Dipterix Wang wrote:
> 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
>
2024 Jan 18
1
[External] Re: Choices to remove `srcref` (and its buddies) when serializing objects
On Thu, 18 Jan 2024, Ivan Krylov via R-devel wrote:
> ? Tue, 16 Jan 2024 14:16:19 -0500
> Dipterix Wang <dipterix.wang at gmail.com> ?????:
>
>> 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
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.
2024 Jan 18
1
Choices to remove `srcref` (and its buddies) when serializing objects
? Tue, 16 Jan 2024 14:16:19 -0500
Dipterix Wang <dipterix.wang at gmail.com> ?????:
> 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 can show how this can be done, but
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
2009 Feb 12
1
Why is srcref of length 6 and not 4 ?
Hello,
Consider this file (/tmp/test.R) :
<file>
f <- function( x, y = 2 ){
z <- x + y
print( z )
}
</file>
I get this in R 2.7.2 :
> p <- parse( "/tmp/test.R" )
> str( attr( p, "srcref" ) )
List of 1
$ :Class 'srcref' atomic [1:4] 1 1 4 1
.. ..- attr(*, "srcfile")=Class 'srcfile' length 4 <environment>
2012 Jul 05
1
Extracting srcref for S4 methods
Hi,
on R version 2.15.1 (2012-06-22) (Platform: i686-pc-linux-gnu (32-bit))
sourced functions have srcref attached as an attribute.
Are such data also available for S4 generics and methods? How? (See
sample code below)
Thank you.
Bests,
Renaud
f <- textConnection(
"
f <- function(){}
setGeneric('myfun', function(x, ...) standardGeneric('myfun'))
2013 Dec 13
1
Proper way to drop 'srcref' from an expression created via substitute(function() ...)?
First, why does this expression have a 'srcref' element:
> exprA <- substitute(function(x) a*x, list(a=2))
> print(exprA)
function(x) 2 * x
> str(as.list(exprA))
List of 4
$ : symbol function
$ :Dotted pair list of 1
..$ x: symbol
$ : language 2 * x
$ :Class 'srcref' atomic [1:8] 1 20 1 34 20 34 1 1
.. ..- attr(*, "srcfile")=Classes
2020 Sep 02
3
sys.call() 's srcref doesn't match the language
Dear R-devel,
I found this behavior disturbing, if `1 + f()` is called, `sys.call()`
called inside of `f` will return a quoted `f()` with a "srcref" that prints
"1 + f()".
I don't know which one is good but I don't think they can be correct at the
same time.
Here's a reproducible example:
f <- function(){
sc <- sys.call()
print(sc)
attr(sc,
2018 Jun 20
0
incomplete results from as.character.srcref() in some cases involving quote()
wholeSrcref attribute is documented in ?parse to be the source reference
corresponding to the already parsed text. The implementation in the
parser matches the documentation - the code stops at the last
byte/character of the expression, that is, on the closing brace - which
is the "already parsed text". I think this works as documented (also
source() uses the current implementation
2018 Jun 18
2
incomplete results from as.character.srcref() in some cases involving quote()
Hi,
The result of as,character() on 'srcref' objects doesn't have the closing ')' in some cases involving 'quote':
> e4 <- quote({2+2})
> class(attr(e4, "wholeSrcref"))
[1] "srcref"
> as.character(attr(e4, "wholeSrcref"))
[1] "e4 <- quote({2+2}"
As a result printing the object also lacks it and gives an
2011 Nov 19
0
Problems with new srcref warnings in R 2.14 (development)
Dear R developers,
Print method for function now tries to open the source file associated
with srcref of the function.
It outputs only the warning, if file cannot be open, and forgets to
print the function definition.
Example:
eval(parse(text = "tf <- function(a){
b <- a^4
b
}", srcfile = srcfile("xxx at 17")))
> tf
<srcref: file "xxx at 17"
2014 Jan 07
1
Why do methods of "initialize" have no "srcref" attribute as other S4 mehtods?
For documentation we use a system that generates Rd files from special
comments in the code. (inlinedocs).
It is crucial to be able to get the defining source code for objects like
methods to extract the comments from it.
Here is an R session that shows how this works for several kinds of methods
and (at the end of the session) how if fails for methods of "initialize"
>
2006 Jan 11
4
Member.buddies.sort >> undefined method `<=>''
Hi all
I have a model Member that has a habtm relationship to buddies (also
members).
Now I wanted to sort them using sort, but this ends in an error
"undefined method <=>"! Where''s the problem here? Sorry, I''m still
beginning to learn Ruby. ;-)
Thanks
Josh
--
Posted via http://www.ruby-forum.com/.
2004 Dec 23
1
Polycom Buddies
I've got two Polycom 500's that I'm playing with, and I want view the status of either phone, (busy/on the phone/etc.) from the other.
I've got this cute little 'Buddies' button, and I can add contacts to that. But the status doesnt actually update.
Do I need to setup realtime for asterisk? Can anyone point me to some documentation or give me some hints?
Thanks,
Nihal
2006 Dec 07
2
Polycom buddies question
I know this is not asterisk specific but we all know this group is used
for Polycom issues as well...
I have hints working ok on Asterisk. However the Polycom phone will
only show the buddies key if there is not a call. This defeats the
purpose of using the buddies to see if you can transfer a call to
another extension (using the Buddy key to see if they are on the phone).
Polycom sip
2007 Jan 18
1
RE: Polycom buddies question
A follow up (late better than never)
Finally had time to sit down and look at this
sip.cfg
<keys key.scrolling.timeout="1"
key.IP_500.31.function.prim="BuddyStatus"/>
This turns the Services key which I never use on a 501 into the Buddy
Status. It even works while on a call. One touch!
Bill
________________________________
From: Bill Gibbs
2010 Mar 10
1
BLF and realtime SIP buddies
Hello list,
Can I do something like this for BLF functionality :
[test-blf]
exten => _XX,hint,Macro(GetSIPaccount,${EXTEN})
exten => _XX,hint,SIP/${SIPACCOUNT}
GetSIPaccount is a macro that looks at a MySQL-database for the realtime
table sip_buddies where the SIPusername is taken from.
It works great for internal calls... but how about BLF-functionality ??
Feedback is appreciated !
2011 May 12
1
Recursively parsing srcrefs
Hi all,
Is it possible to "recursively" parse srcrefs to match the recursive
structure of the underlying code? I'm interested in this because it's
the final step in allowing functions to modify other functions while
preserving the original source. I've tried to make a bit of demo of
what I want to do below, and I think I may uncovered a bug in parse.
f <- function(x =