Hi,

Andy Wingo <wi...@pobox.com> skribis:

> Regarding identity, `cons' needs to return objects with identity.  These
> expressions expressions are not the same:
>
>   (define f
>     (let ((pair (cons 1 2)))
>       (lambda ()
>         pair)))
>
>   (define f
>     (lambda ()
>       (cons 1 2)))
>
> Here we cannot propagate `pair' because then we would break (eq? (f)
> (f)).  It's a question of identity.

Right, good point.

[...]

> `car' is pure -- if its argument is
> indeed a pair, then it has no side effects -- but it is not constant.

OK, got it!

(Though I think that the term ‘constant’, as used by GCC, is confusing.
I don’t have a better name to propose, though.)

[...]

>>> Also, if I'm correct in guessing the reason for this change (accessing
>>> mutable memory), shouldn't the bytevector-*-ref operations go as well?
>>
>> No because they return an immutable object.
>
> I think we got this wrong, Ludo, and we should probably create some list
> of pure accessors for mutable data and put bytevector-*-ref in it, for
> the same reason given above for `h'.

Yes, agreed.

Thanks!

Ludo’.

PS: In that context, it must be quite a relief to work on a purely
    functional language...  :-)

Reply via email to