dropping \ and introducing 'protect' in Shen 5.0

98 views
Skip to first unread message

Mark Tarver

unread,
Jul 31, 2012, 1:06:36 PM7/31/12
to Qilang
One feature which I intend to drop in Shen 5.0 is \. In Shendoc it
says.

A string in Shen begins with " and ends with ". To embed a string in a
string the escape character is \ which instructs the reader to ignore
the conventions attaching to the succeeding character and read it as
part of the string.

This was introduced as a hack to allow strings to be embedded in
strings, but really after character codes were introduced in November
2011 there is really no need for \.

Another change is the treatment of free variables as in:

(define f
X -> Y)

which generates a warning that Y is a free variable. About 90% of
cases the free variable is actually an error. However when loading a
program these warnings often scroll off the screen and so they are
missed. I propose to elevate the warning to be an error and allow the
user to use 'protect' to explicitly signal that he is aware that a
free variable is introduced. In such a case there would be no error
and no warning

(define f
X -> (protect Y))

For typechecking purposes 'protect' would have the type symbol -->
symbol and would be defined as the identity function and the Shen
compiler would strip 'protect' off when generating KLambda.

Mark

Ian Tegebo

unread,
Aug 11, 2016, 3:51:15 PM8/11/16
to Shen
I was unable to find "protect" documented in either the docs shipped with Shen or on the web page (or in the code).  If that was deliberate, please ignore, otherwise this is a reminder to update.

Thanks,

On Tuesday, July 31, 2012 at 10:06:36 AM UTC-7, Mark Tarver wrote:
[...]

Willi Riha

unread,
Aug 11, 2016, 6:50:30 PM8/11/16
to Shen
protect is described in the Shen Book 3rd ed, p.29, p.112 (in 2nd edn., p. 29 and p.113)

Ian Tegebo

unread,
Aug 12, 2016, 9:06:47 AM8/12/16
to Shen
Thanks Willi!

While I have TBoS 1st and 2nd, I don't have the 3rd.  In the 2nd, I don't see it in the main or system function indices in the back of the book; I've updated my copy.

deech

unread,
Aug 12, 2016, 9:06:59 AM8/12/16
to Shen

Another change is the treatment of free variables as in:

(define f
  X -> Y)

which generates a warning that Y is a free variable.  About 90% of
cases the free variable is actually an error.
Yes, absolutely, this should be a "compile" time error. Most mainstream dynamic languages don't do proper scope checking and this would, yet again, differentiate Shen.
-deech
Reply all
Reply to author
Forward
0 new messages