From: Kalle Olavi Niemitalo on
rpw3(a)rpw3.org (Rob Warnock) writes:

> However, in CMUCL APROPOS and/or DESCRIBE can be very useful for
> finding stuff, [...]

DESCRIBE will indeed name the source file of a function or macro:

| * (describe 'x86::defenum)
|
| DEFENUM is an internal symbol in the X86 package.
| Macro-function: #<Function (:MACRO X86::DEFENUM) {10D507B9}>
| Macro arguments:
| ((&key (prefix "") (suffix "") (start 0) (step 1)) &rest identifiers)
| On Thursday, 9/4/03 09:44:18 pm [-3] it was compiled from:
| target:compiler/generic/vm-macs.lisp
| Created: Friday, 5/23/03 12:20:37 am [-3]
| Comment: $Header: /home/anoncvs/CVS-cmucl/src/compiler/generic/vm-macs.lisp,v 1.19 2002/10/07 14:31:07 toy Exp $

However, I think my difficulty was with a constant defined
with this macro. For example:

| * (describe 'x86:even-fixnum-type)
|
| EVEN-FIXNUM-TYPE is an external symbol in the X86 package.
| It is a constant; its value is 0.

Here, DESCRIBE did not say where the constant is defined.
(It is defined in target:compiler/generic/objdef.lisp.)
This was with CMUCL 18e from 2003, and was not specific
to X86::DEFENUM; plain DEFCONSTANT had the same problem.
Are later versions more helpful?
From: Rob Warnock on
Kalle Olavi Niemitalo <kon(a)iki.fi> wrote:
+---------------
| rpw3(a)rpw3.org (Rob Warnock) writes:
| > However, in CMUCL APROPOS and/or DESCRIBE can be very useful for
| > finding stuff, [...]
|
| DESCRIBE will indeed name the source file of a function or macro:
| | * (describe 'x86::defenum)
....
| | On Thursday, 9/4/03 09:44:18 pm [-3] it was compiled from:
| | target:compiler/generic/vm-macs.lisp
....
| However, I think my difficulty was with a constant defined
| with this macro. For example:
|
| | * (describe 'x86:even-fixnum-type)
| |
| | EVEN-FIXNUM-TYPE is an external symbol in the X86 package.
| | It is a constant; its value is 0.
|
| Here, DESCRIBE did not say where the constant is defined.
| (It is defined in target:compiler/generic/objdef.lisp.)
| This was with CMUCL 18e from 2003, and was not specific
| to X86::DEFENUM; plain DEFCONSTANT had the same problem.
| Are later versions more helpful?
+---------------

Yes, actually!! Any version of "19a-pre3" or later should give you this:

cmu> (describe 'x86:even-fixnum-type)

EVEN-FIXNUM-TYPE is an external symbol in the X86 package.
It is a constant; its value is 0.
It is defined in:
target:compiler/generic/objdef.lisp
cmu>

As you can probably guess by now, however, grepping for "even-fixnum-type"
in that file will only show you the EXPORT, not the definition, which
is constructed from a shorter name with DEFENUM (circa line 97) [which
is the whole point of this sub-thread (*sigh*)]:

;;; The main types. These types are represented by the
;;; low three bits of the pointer or immediate object.
;;;
(defenum (:suffix -type)
even-fixnum ; <=== EVEN-FIXNUM-TYPE is defined here.
function-pointer
other-immediate-0
list-pointer
odd-fixnum
instance-pointer
other-immediate-1
other-pointer)

But at least DESCRIBE says which file to look in... ;-} ;-}


-Rob

-----
Rob Warnock <rpw3(a)rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607

From: Günther Thomsen on
On Dec 28 2009, 1:34 am, Lars Rune Nøstdal <larsnost...(a)gmail.com>
wrote:
[..]
> Hm, sort of related I guess(?) -- I've been using this at times:
>
> CL-USER> (set-macro-character #\¤
>                               (lambda (stream char)
>                                 (declare (ignore char))
>                                 `(slot-value %with-object ',(read
> stream)))
>                               t)
> T
>
[..]
Non ASCII character in source code? Eek. Not even my webbrowser
renders this(or does it? hard to tell), my shell wont for sure.
There are many pretty characters outside ASCII, but using them doesn't
necessarily makes the code easier to read (see APL for an extreme
example) and causes often difficulties for others to render or enter
them. It can be frustrating, that ASCII is the largest common
denominator, but for the time being, we have to live with it.
From: Pascal J. Bourguignon on
G�nther Thomsen <guenthert(a)gmail.com> writes:

> On Dec 28 2009, 1:34�am, Lars Rune N�stdal <larsnost...(a)gmail.com>
> wrote:
> [..]
>> Hm, sort of related I guess(?) -- I've been using this at times:
>>
>> CL-USER> (set-macro-character #\�
>> � � � � � � � � � � � � � � � (lambda (stream char)
>> � � � � � � � � � � � � � � � � (declare (ignore char))
>> � � � � � � � � � � � � � � � � `(slot-value %with-object ',(read
>> stream)))
>> � � � � � � � � � � � � � � � t)
>> T
>>
> [..]
> Non ASCII character in source code? Eek. Not even my webbrowser
> renders this(or does it? hard to tell), my shell wont for sure.
> There are many pretty characters outside ASCII, but using them doesn't
> necessarily makes the code easier to read (see APL for an extreme
> example) and causes often difficulties for others to render or enter
> them. It can be frustrating, that ASCII is the largest common
> denominator, but for the time being, we have to live with it.

At least 10 years too late. Now the largest common denominator is unicode.

That said, it could have been written as:

(set-macro-character #\CURRENCY_SIGN ...)


--
__Pascal Bourguignon__ http://www.informatimago.com/