REBOL3 tracker
  0.9.12 beta
Ticket #0000749 User: anonymous

Project:



rss
TypeWish Statusdismissed Date5-May-2009 02:10
Versionalpha 50 Categoryn/a Submitted byBrianH
PlatformAll Severityminor Prioritynormal

Summary Make FUNCTOR use explicit initialization of the local object, and gather set-words as dynamic locals.
Description The current behavior of FUNCTOR has gone a year without being used once afaict.

I think it is because of these problems:
- There is no defined initialization of the fields of the object.
- There is no way to specify dynamic local variables, short of putting them in the spec.
These make FUNCTOR less useful than FUNCT.

Ladislav (mostly) proposed an explicit init block for FUNCTOR, and to have the gathered set-words be defined as local variables if they aren't in the spec or local object. This is now feasible with the COLLECT-WORDS function exposed in alpha 49.

This version of FUNCTOR has use cases already:
- Handlers with predefined specs and persistent local words.
- Functions with local functions (like SECURE).
- Contexts with local words but one exported function (like PARSE-URL).
- Functions with local values preconstructed using COMPOSE of the code block (like many PARSE wrappers I write).

This is implemented in mezz-func.r 4017.

An enhancement would be to allow the init to be either an init block or an object reference, for binding functions to a shared object. This would allow you to make objects with global functions without using the SET 'funcname trick. This is implemented in mezz-func.r 4019.
Example code
ascii?: functor [
	"Returns TRUE if value or string is in ASCII character range (below 128)."
	value [any-string! char! integer!]
] [
	ascii: charset [#"^(00)" - #"^(7F)"]
] [
	either any-string? value [parse/all/case value [any ascii]] [value < 128]
]

Assigned ton/a Fixed in- Last Update6-May-2009 21:00


Comments
(0000636)
Carl
5-May-2009 20:12

Since they are unused, let's just move it to the "R3/Plus" package, not the main release.
(0000656)
BrianH
6-May-2009 21:00

This doesn't match the definition of the word "functor", so this should be denied, not deferred.

The change to FUNCT proposed in #766 should be done instead.

Date User Field Action Change
6-May-2009 21:00 BrianH Status Modified deferred => dismissed
6-May-2009 21:00 BrianH Comment : 0000656 Modified -
6-May-2009 21:00 BrianH Comment : 0000656 Added -
6-May-2009 20:57 BrianH Comment : 0000637 Removed -
5-May-2009 21:25 BrianH Comment : 0000637 Modified -
5-May-2009 20:37 BrianH Comment : 0000637 Modified -
5-May-2009 20:37 BrianH Comment : 0000637 Added -
5-May-2009 20:12 carl Status Modified pending => deferred
5-May-2009 20:12 carl Comment : 0000636 Added -
5-May-2009 02:11 BrianH Description Modified -
5-May-2009 02:11 BrianH Code Modified -
5-May-2009 02:11 BrianH Status Modified submitted => pending
5-May-2009 02:10 BrianH Ticket Added -