[REBOL] Re: Rebol Product Suggestion.
From: joel:neely:fedex at: 23-Jun-2001 4:18
Hi, Gabriele,
Your remarks are inspiring, as usual! (Of course there's
a fine line between inspiration and madness. ;-)
Gabriele Santilli wrote:
> Encryption never gives you security over source code. To
> execute you have to decrypt, so any user has to be able to
> decrypt.
>
Unless RT adds a primitive that's the equivalent of
do decrypt somestring
somestring: ""
(per a discussion at least a year ago on this list).
> In the case of REBOL, noone stops you from creating a very
> unreadable script that cannot be (easyly) understood or
> modified by a human but that can be evaluated by the REBOL
> interpreter...
>
> What I'd do is creating a script that takes a normal
> (commented, readable etc.) REBOL script and writes out
> another script that does exactly the same thing as the
> first but is not readable by humans.
>
I played with this idea a while back. We could begin with
8<--------------------------------------------------------
propercase: func [
{capitalize first letter only of a string}
s [string!] {original string - unchanged}
][
head change lowercase copy s uppercase copy/part s 1
]
ply: func [
{create a string from series and separator arguments}
ser [series!] {series of values to be collected}
sep [string! char!] {value to go between elements}
/local
result {accumulator for string}
nextsep {what precedes next item?}
][
result: copy nextsep: ""
foreach item ser [
repend result [nextsep item]
nextsep: sep
]
result
]
map: func [
{return mapped-function results for all ser items}
[catch]
ser [block! hash! string!] {inputs}
mapped-function [any-function!]
/all {return none? values?}
/local
res {result block}
val {single-item result value}
][
res: make type? ser length? ser
throw-on-error [
foreach item ser [
if any [
found? val: mapped-function item
all
][
append/only res val
]
]
]
res
]
capitalize: func [
{return string with uppercased first letters}
s [string!] {unmodified input}
][
ply map parse s none :propercase " "
]
8<--------------------------------------------------------
And apply rules such as:
- Remove comments.
- Never allow meaningful names
- Use names hard to distinguish
- Replace simple constants/expressions with more obscure
expressions
- Never allow whitespace to reveal structure
and arrive at
8<--------------------------------------------------------
capitalize: func [ I1l1I [string!] /local O0Ol0 IIOOO ] [
O0Ol0: func [ OO01O [series!] O00I0 [string! char!] /local
OOOIO O0010 ] [ OOOIO: copy O0010: copy tail mold 17 foreach
O0OIO OO01O [ repend OOOIO [O0010 O0OIO] O0010: O00I0 ]
OOOIO ] IIOOO: func [ IIOOI [block! hash! string!] IIOO1
[any-function!] /IIO0I /local II000 III0l ] [ II000: make
type? IIOOI length? IIOOI foreach II1Ol IIOOI [ if any [
found? III0l: IIOO1 II1Ol IIO0I ] [ append/only II000 III0l
] ] II000 ] O0Ol0 IIOOO parse I1l1I none func [ lOOO1
[string!] ] [ head change lowercase copy lOOO1 uppercase
copy/part lOOO1 index? head lOOO1 ] to-string to-char 32 ]
8<--------------------------------------------------------
> (I'm likely to write something like this sooner or later
> as I might need it.)
>
However, I found that some of those rules were VERY hard to
describe in purely syntactic terms, actually requiring an
ability to read and understand REBOL. Since I'm still
working on creating a model that *I* can understand, I don't
yet know how to program the required knowledge. I'll be
fascinated to see any progress you might make! Good luck!
-jn-
------------------------------------------------------------
Programming languages: compact, powerful, simple ...
Pick any two!
joel'dot'neely'at'fedex'dot'com