REBOL3 tracker
  0.9.12 beta
Ticket #0000766 User: anonymous

Project:



rss
TypeWish Statustested Date6-May-2009 20:55
Versionalpha 51 Categoryn/a Submitted byBrianH
PlatformAll Severityminor Priorityhigh

Summary FUNCT option to define a persistent local object, or bind to an existing object
Description It would be helpful to be able to optionally define persistent local words for a FUNCT function, or to safely bind the function's code block to a provided object.

Some use cases:
- Handlers with predefined specs and persistent local words.
- Handlers bound to the object they are handling for, after the object is defined.
- Functions with local functions (like SECURE).
- Contexts with local words but one exported function (like PARSE-URL).
- Contexts that currently have global functions defined with SET 'name.
- Functions with local values preconstructed using COMPOSE of the code block (like many PARSE wrappers I write).

This has the additional advantage of being able to define what in other languages are called "friend" functions.

This proposal is an alternative to #749.
Example code
ascii?: funct/with [
	"Returns TRUE if value or string is in ASCII character range (below 128)."
	value [any-string! char! integer!]
] [
	either any-string? value [parse/all/case value [any ascii]] [value < 128]
] [
	ascii: charset [#"^(00)" - #"^(7F)"]
]

Assigned ton/a Fixed inalpha 53 Last Update12-May-2009 07:01


Comments
(0000655)
BrianH
6-May-2009 20:57

Implemented in mezz-func.r 4089.

Date User Field Action Change
12-May-2009 07:01 BrianH Fixedin Modified => alpha 53
12-May-2009 07:01 BrianH Status Modified pending => tested
6-May-2009 20:57 BrianH Comment : 0000655 Added -
6-May-2009 20:56 BrianH Description Modified -
6-May-2009 20:56 BrianH Code Modified -
6-May-2009 20:56 BrianH Status Modified submitted => pending
6-May-2009 20:55 BrianH Ticket Added -