Bug 15077 - bquote() fails to set the default of a function of one argument
bquote() fails to set the default of a function of one argument
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Misc
R 2.15.1
All All
: P5 minor
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-20 02:58 UTC by Peter Meilstrup
Modified: 2012-10-23 16:05 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Meilstrup 2012-10-20 02:58:47 UTC
##This is from the help for `bquote`:
bquote( function(x, y = .(default)) x+y )
## result:
# function(x, y = 1) x + y

##However this doesn't work when there is one argument to the function:
default <- 1
bquote( function(y = .(default)) y )
## expected result:
# function(y = 1) y
## actual result:
# function(y = .(default)) y

This should be fixed in bquote by simply moving the check for a pairlist before the length check.
Comment 1 Brian Ripley 2012-10-21 13:36:29 UTC
Fixed in 2.15.2 patched
Comment 2 Peter Dalgaard 2012-10-21 15:07:08 UTC
....meaning fixed in r-devel, scheduled for 2.5.2 patched, I suppose. 

(2.5.2 is in code freeze and should only be unfrozen in case of truly severe problems.)
Comment 3 Brian Ripley 2012-10-23 16:05:43 UTC
As I and the NEWS item said, for '2.15.2 patched'.