PennMUSH Community

Ticket #7669 (new suggested feature)

Opened 3 months ago

Last modified 3 months ago

A alternative LIT()

Reported by: Mercutio Assigned to:
Priority: minor Milestone:
Keywords: Cc:
Visibility: Public

Description

There are occasions where I see other people, as well as myself, needing something where functions are ignored, and substitutions are not... or the other way around. Normally, if you don't want something evaluated, you use lit()... however lit() is mightily useless if you want it to still evaluate SOMETHING within it.

So I am suggesting an ARGLIT() function which would work as follows:

ARGLIT(arguments,text)

Where the arguments can be 'functions', 'certain functions' (like builtin / stuff), registries, substitutions... stuff like that. And the text being what one would normally put in lit() however with the arguments going over it to see what it should evaluate ahead of time.

(But this is probably insanely hard X.x)

Change History

07/18/08 16:42:17 changed by walker

Hm. Thinking and talking about this with Mike:

Maybe a change to p_e to allow PE_COSMETIC and to function table for FN_COSMETIC.

functions marked FN_COSMETIC are purely cosmetic - e.g: reverse(), ansi(), etc.

If PE_COSMETIC is set, no functions that aren't marked FN_COSMETIC can be used.

This is then accessible by either attribute flag cosmetic, or compose() (The opposite of decompose(), only it allows other purely cosmetic functions. So compose(decompose(<any string>)) gets that string.) Other names may be better. safeeval? ucosmetic([obj/]attr,args) ? scosmetic() ? s(string,cosmetic) ?

What's defined as cosmetic? Any function that does not check any privileges, any locks, etc.

reverse(), mid(), left(), align(), etc are cosmetic. Most math and string functions would be cosmetic.

name() could be cosmetic, as well as all poss()/etc. mwho() is cosmetic, lwho() is not.

get() is not cosmetic. %L and %@ are probably not cosmetic, as is loc(). pemit() is not cosmetic. u()-family is not cosmetic.

iter() is cosmetic. map()/etc using #lambda/ would be cosmetic, using an attribute would not be cosmetic.

This would primarily be of use in allowing people to post code with limited evaluation. (For, e.g, bb systems, +mail, +help, etc).

Kinda similar to the nosidefx flag posted by Mike, but a lot more secure and of more limited scope. (Particularly since u()/etc are considered nosidefx!)