REBOL3 tracker
  0.9.12 beta
Ticket #0001584 User: anonymous

Project:



rss
TypeWish Statustested Date29-Apr-2010 05:39
Versionalpha 97 CategoryNative Submitted byBrianH
PlatformAll Severityminor Priorityhigh

Summary SELFLESS? function
Description SELFLESS? would take a context parameter with the same spec as BIND's, and would return true if BIND doesn't bind 'self for that context. This is true of function contexts, and as of alpha 98 the contexts generated by loops and closures as well. If an unbound word is passed as a parameter, the same error that BIND would trigger should be triggered here as well.

This function will help people screen contexts when their code absolutely depends on 'self being bound. This can happen when the existing binding of 'self in the code would cause a context leak (a security hole).
Example code
; The source
selfless?: func [
    "Returns true if the context doesn't bind 'self."
    context [any-word! any-object!] "A reference to the target context"
    /local self
][
    'self =? first bind/copy [self] context
]

Assigned ton/a Fixed inalpha 99 Last Update8-May-2010 00:24


Comments
(0002278)
BrianH
30-Apr-2010 04:46

Implemented in mezz-control.r 7225. Note that this requires the #1528 changes scheduled for alpha 98 to run properly.
(0002360)
Carl
7-May-2010 22:14

A clever function indeed, but it's been added as native (it's just a simple internal check.)

Date User Field Action Change
8-May-2010 00:24 BrianH Category Modified Mezzanine => Native
8-May-2010 00:24 BrianH Status Modified built => tested
7-May-2010 22:14 carl Comment : 0002360 Added -
7-May-2010 22:12 carl Fixedin Modified => alpha 99
7-May-2010 22:12 carl Status Modified waiting => built
5-May-2010 23:31 carl Status Modified pending => waiting
30-Apr-2010 04:47 BrianH Status Modified submitted => pending
30-Apr-2010 04:46 BrianH Comment : 0002278 Added -
29-Apr-2010 20:09 BrianH Priority Modified normal => high
29-Apr-2010 18:38 BrianH Description Modified -
29-Apr-2010 18:38 BrianH Code Modified -
29-Apr-2010 05:39 BrianH Ticket Added -