news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone) 
Author Message
 news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)

Note that "unification" as implemented in Prolog is NOT unification as
understood by logicians, since the "occurs check" is not performed.
This check is a significant complication of the algorithm, and has
significant cost (see my rendering of A&S just posted).

The ML'ers must have done a unification with an occurs check
for SML in Poplog, though I doubt if their code is general-purpose, dealing
as it does with unification of SML type structures. Failure of the occurs
check is manifest by the distressing message "unification failure - cyclic
type structure".

Robin.



Sat, 20 Apr 2002 03:00:00 GMT  
 news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)

Compare and contrast:

define fred(x) with_nargs 255;

enddefine;

[error reported]

with:

define fred(x);

enddefine;

255->pdnargs(fred);

[Why do I want to do this - for UMASS Scheme I'm proposing to flag
polyadic functions with 255 as their pdnargs. Shouldn't trip up
anybody unless they are cooking up Scheme with a program generator...

Robin.



Sat, 20 Apr 2002 03:00:00 GMT  
 news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)

Another gripe I have is that POP-11 doesn't let me use a protected
identifier as a lexical local

define fred();
    lvars exp = 23;
enddefine;

This seems unreasonable, and undesirable, 'cos it's handy to use
familiar signs, e.g.:

define average(x,y,Algebra)
    let nonop + = Algebra("+"), nonop / = Algebra("/")
    in
        (x+y)/2
    endlet
enddefine;

Robin.



Sat, 20 Apr 2002 03:00:00 GMT  
 news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)
[To reply replace "Aaron.Sloman.XX" with "A.Sloman"]

Quote:

> Another gripe I have is that POP-11 doesn't let me use a protected
> identifier as a lexical local

> define fred();
>     lvars exp = 23;
> enddefine;

> This seems unreasonable, and undesirable, 'cos it's handy to use
> familiar signs, e.g.:

> define average(x,y,Algebra)
>     let nonop + = Algebra("+"), nonop / = Algebra("/")
>     in
>         (x+y)/2
>     endlet
> enddefine;

I suppose one problem is that a user may accidentally include a
protected identifier because of leaving out a semi-colon, or

    define foo(p, q) -> z;
        lvars x = ..., y = ...,
        x + y -> z
    enddefine;

So in general the compile time error message guards people against
mistakes.

The sophisticated user who really wants to can temporarily unprotect
an identifier required as a lexical local;

sysunprotect("exp");

define foo();
    lvars exp = 5;
    exp*exp =>
enddefine;

sysprotect("exp");

foo();
** 25

Aaron
===
--
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (NB: Anti Spam address)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/



Sun, 21 Apr 2002 03:00:00 GMT  
 news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)
[To reply replace "Aaron.Sloman.XX" with "A.Sloman"]

Quote:

> Date: 2 Nov 1999 19:01:56 GMT

> Compare and contrast:

> define fred(x) with_nargs 255;

> enddefine;

> [error reported]

i.e. (illegal value for with_nargs): 255

Quote:

> with:

> define fred(x);

> enddefine;

> 255->pdnargs(fred);

No error.

However this produces an error:

    256->pdnargs(fred);
    ;;; MISHAP - INTEGER BETWEEN 0 AND 255 NEEDED
    ;;; INVOLVING:  256

In REF SYNTAX it states

    The integer supplied after "with_nargs" must be >= 0 and <= 254.

though it doesn't say why.

From looking at the code in $popsrc, in the two files
    pop11_syntax.p
    procedure.p

There is clearly an inconsistency.

In $popsrc/pop11_syntax.p we find in the code for with_nargs:

                        if isinteger(item) and 0 fi_<= item and item fi_< 255 then
                                item -> nargs
                        else
                                Pdr_error(item, 1, 'illegal value for with_nargs')
                        endif

Whereas in $popsrc/procedure.p

    define updaterof pdnargs(_nargs, p);
        lvars p, _nargs;
        Check_integer_range(_nargs, 0, 16:FF);

Presumably either the first one should have been fi_< 256 or the
second should have used 16:FE ?

I can't tell whether the 255 case is already used somewhere by the
system.

Aaron
===
--
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (NB: Anti Spam address)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/



Sun, 21 Apr 2002 03:00:00 GMT  
 news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)

Aaron said

Quote:
> I suppose one problem is that a user may accidentally include a
> protected identifier because of leaving out a semi-colon, or

    define foo(p, q) -> z;
        lvars x = ..., y = ...,
        x + y -> z
    enddefine;

Which is why I always use my let construct which requires "in" to
terminate the list of variables being declared. Besides, it gives
POP a less antique look.

    define foo(p, q) -> z;
        let x = ..., y = ...,
        in
            x + y -> z
        endlet
    enddefine;

And, while I do still manage to remember "sysunprotect", 'taint clear that
your average user would. R.

[Incidentally, re. pdnargs - I remembered that an pdnargs of 0 makes
perfect sense as a variadic flag for Scheme 'cos all Scheme functions
with a definite arity have a pdnargs >= 1 (for, as in Poplog Common Lisp,
the number of actual parameters is passed as an argument).



Sun, 21 Apr 2002 03:00:00 GMT  
 news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)

Quote:

> Aaron said

> > I suppose one problem is that a user may accidentally include a
> > protected identifier because of leaving out a semi-colon, or

>     define foo(p, q) -> z;
>         lvars x = ..., y = ...,
>         x + y -> z
>     enddefine;

> Which is why I always use my let construct which requires "in" to
> terminate the list of variables being declared. Besides, it gives
> POP a less antique look.

>     define foo(p, q) -> z;
>         let x = ..., y = ...,
>         in
>             x + y -> z
>         endlet
>     enddefine;

I guess you can define your "let" macro (or syntax word) call
sysunprotect and then sysprotect. In between it would have to invoke
pop11_comp_expr to read and compile the expression using the
unprotected identifiers.

For some reason I've lever liked the "let" construct. I generally
prefer a sequence of less deeply nested expressions to a single more
deeply nested one (like sentences).

However, I can see that using "let" gives a more structured style,
and saves having to use lblock and endlblock.

Quote:
> And, while I do still manage to remember "sysunprotect", 'taint clear that
> your average user would. R.

I think your average user (including most student users) probably
would need the protection against errors more than the ability to
redefine protected system identifiers locally.

I've just remembered that HELP COMPILE_MODE mentions a compile time
switch that does what you want:

    prmprt      If unset, an error is NOT signalled if a protected
                permanent identifier is redeclared (by sysSYNTAX,
                ident_declare etc).

So to turn off the checking in a procedure or a file you should be
able to use
    compile_mode :vm -prmprt;

Thank John Gibson!

aaron
===
--
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (NB: Anti Spam address)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/



Mon, 22 Apr 2002 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)

2. news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)

3. news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)

4. news-relayFrom: pop@roo.cs.umass.edu (Robin Popplestone)

5. news-relayFrom: pop@edu.umass.cs.roo (Robin Popplestone)

6. news-relayFrom: pop@edu.umass.cs.roo (Robin Popplestone)

7. news-relayFrom: pop@edu.umass.cs.roo (Robin Popplestone)

8. news-relayFrom: pop@edlab.cs.umass.edu (Robin Popplestone)

9. news-relayFrom: pop@edu.umass.cs.winnie (Robin Popplestone)

10. news-relayFrom: pop@uucp.rabbit (pop)

11. vwnc@cs.uiuc.edu

12. NOW SHOWING - wiki.cs.uiuc.edu/VisualWorks/Recent+Changes

 

 
Powered by phpBB® Forum Software