REBOL3 tracker
  0.9.12 beta
Ticket #0002194 User: anonymous

Project:

Previous Next
rss
TypeWish Statussubmitted Date25-Feb-2015 17:09
Versionr3 master CategoryNative Submitted byabolka
PlatformAll Severityminor Prioritynormal

Summary APPLY: simplified, non-positional refinement value passing
Description This ticket is only a stub for now (needs a basic rationale explaining the brittleness of current APPLY with refinement arg passing). I thought we discussed and already designed this years ago but then couldn't find it written up as an issue anywhere, so I'll just quickly quote BrianH's re-discovery on SO chat (http://chat.stackoverflow.com/transcript/message/21704505#21704505):

"One way that you could do named-refinement APPLY is to pass in the refinement and options in the argument block, but choose whether to provide that refinement and its associated arguments to the function based on the value assigned to the corresponding word. So, apply :append [[] [5] /only] would pass on /only depending on whether the word only had a truthy value assigned to it."
Example code
;; Another example:

use [deep part length] [
  last: false
  part: true
  length: 3
  apply :take ["foobar" /last /part length]
  ; == "foo"
]

Assigned ton/a Fixed in- Last Update2-Mar-2015 08:06


Comments
(0004573)
BrianH
2-Mar-2015 08:06

Thanks for posting this placeholder; I'll flesh out the proposal when I'm able.

We never came up with this proposal before in any conversation I was aware of, but there were a couple years of conversations that I wasn't around for so I can't speak to what was said in them. However, the alternate proposal for choosing just based on the existence of the refinement in the argument list has been proposed over and over again, and again earlier in the conversation that you referenced.

Date User Field Action Change
2-Mar-2015 08:11 BrianH Comment : 0004573 Modified -
2-Mar-2015 08:06 BrianH Comment : 0004573 Added -
25-Feb-2015 17:09 abolka Ticket Added -