Re: Code style question



Duane Rettig writes:

On Feb 28, 8:31 am, "Tobias C. Rittweiler" <...> wrote:

[2] It does matter a whole lot more with environment access as DEFTYPE
    definitions can access the current compilation environment. Any
    environment proposal should probably address that matter. I do not
    know whether Duane Rettig's env-access proposal tackles this issue.

    (Duane, if you happen to read this footnote, did you deal with this
    problem?)

I don't see it as a problem, and so I never dealt with it. I don't
know why a compiler would consider these two declarations as applying
to anything but the same variable, with the same scope.

I thought I could construct an example where it were ambiguous. But I
now I can't. Meh! :-)


I recall that the standard says that consequences are undefined if two
declaration specifiers contradict each other, but I cannot find any
reference. In the absence of such a paragraph, the behaviour of the
following is not totally clear:

(declare (inline foo) (notinline foo))

vs.

(declare (notinline foo) (inline foo))

or even

(declare (optimize (speed 1)))
(declare (optimize (speed 3)))

vs.

(declare (optimize (speed 3)))
(declare (optimize (speed 1)))

There's nothing that says that the later comming declaration should
prevail.


And environment access complicates the issue. Let's consider something
on the line of

(deftype quux (&environment env)
(if (declaration-information 'ENABLE-FROBBAGE env)
'%unsafe-quux
'%safe-quux))

What is the type specifier QUUX supposed to expand in the following
snippets:

(declare (enable-frobbage t) (type quux *foo*))

vs.

(declare (type quux *foo*) (enable-frobbage t))

or

(declare (enable-frobbage t))
(declare (type quux *foo*))

vs.

(declare (enable-frobbage t))
(declare (type quux *foo*))


A more ambiguous question is: what variable does the following
declaration affect (which is of course a bouund declaration)?

(let* ((x (foo))
(y (bar x))
(x (bas y)))
(declare (fixnum x))
...)

I'd be inclined to say both. :-) How did the Franz people decide to deal
with this?

-T.
.



Relevant Pages

  • Re: "Sorting" assignment
    ... If the array is already sorted, this means that you end up ... less time than a bubble sort, ...     int intLeft, ... I don't declare anything inside of a loop is why. ...
    (comp.programming)
  • Re: Microsoft Office updates that are not backward compatable with Microsoft VB 6.5
    ... Dim rst, rstFill As ADODB.Recordset ... That is, in VB, any variable declared without "As" will be Variant, whether ... better readability and for the explicity, I never declare variable in one ...    Dim rst, rstFill As ADODB.Recordset ...
    (microsoft.public.office.developer.vba)
  • Re: THE to function as DECLARE?
    ...     ... the THE form is redundant in (THE FIXNUM 2). ... AMX> (declaim (inline square)) ... time even when I don't feel like adding (declare ..)'s "manually". ...
    (comp.lang.lisp)
  • Re: Srange problem
    ... Daniel Moyne wrote: ...     list.add; ... It's not a raw Map. ... You should not declare a raw 'Iterator'. ...
    (comp.lang.java.help)
  • Re: OT: interesting global warming quote found elsewhwere
    ... economic system displayed in its philosophical rout of Marxism-Leninism ...   (pg. ... 1) Our system /has/ taken great note and alarm about the environment. ... puting legisative limits of amount of pollutant that can be released. ...
    (sci.electronics.design)