From murdoch.duncan at gmail.com  Fri Jan 23 21:59:29 2015
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Fri, 23 Jan 2015 15:59:29 -0500
Subject: [Rd] :: and ::: as .Primitives?
In-Reply-To: <CAGh0NYq=XxvwMCZ=eLqTt6GewJR-6SOXQJOYfwJeODb=yRau+g@mail.gmail.com>
References: <CAGh0NYotjwDf5JYGcTggJWhWUSVsmBAuhbtGzwqsO+nXBpthyQ@mail.gmail.com>	<alpine.LFD.2.11.1501221330230.10879@itasca.stat.uiowa.edu>	<CAOQ5NycWpawep=tFCEkVRbU-Hy-asCUowaQF9a1H41d5z7Owfw@mail.gmail.com>
	<CAGh0NYq=XxvwMCZ=eLqTt6GewJR-6SOXQJOYfwJeODb=yRau+g@mail.gmail.com>
Message-ID: <54C2B631.8010600@gmail.com>

On 22/01/2015 4:06 PM, Peter Haverty wrote:
> Hi all,
> 
> I use Luke's "::" hoisting trick often. I think it would be fantastic
> if the JIT just did that for you.
> 
> The main trouble, for me, is in code I don't own.  When common
> Bioconductor packages are loaded many, many base functions are saddled
> with this substantial dispatch and "::" overhead.
> 
> While we have the hood up, the parser could help out a bit here too.
> It already has special cases for "::" and ":::". Currently you get the
> symbols "pkg" and "name" and have to go fishing in the calling
> environment for the associated values.  

I don't think the parser should do this, but it does seem like a
reasonable optimization for the compiler to do.

It would be nice to have the
> parser or JIT rewrite base::match as doubleColon("base","match") or
> directly provide the symbols "base" and "match" to the subsequent
> code.

Currently the parser provides the expression `::`(base, match), and the
`::` function converts those symbols to character strings "base" and
"match".  While the parser could have saved it some work by giving the
expression `::`("base", "match"), I think it's a bad idea to start
messing with things that way.  After all, a user could have defined
their own `::` function, and they should get what they typed.

Duncan Murdoch



[Rd] :: and ::: as .Primitives?
Duncan Murdoch