From: Eric M. <eri...@fr...> - 2013-11-05 14:33:34
|
Hi, The following illustrates recent new restrictions on slot-names which are probably unwanted (though the STYLE-WARNING is useful). * (lisp-implementation-version) "1.1.13.18-4c7c37b-dirty" * (defstruct foo :bar) STYLE-WARNING: Keyword slot name indicates probable syntax error in DEFSTRUCT: :BAR. debugger invoked on a SB-PCL::SLOTD-INITIALIZATION-ERROR in thread #<THREAD "main thread" RUNNING {1002ABB0D3}>: Invalid SB-MOP:SLOT-DEFINITION initialization: the initialization argument :NAME was constant: :BAR. See also: AMOP, Initialization of Slot Definition Metaobjects -- Eric Marsden |
From: Zach B. <xa...@xa...> - 2013-11-06 01:15:44
|
Eric Marsden <eri...@fr...> writes: > Hi, > > The following illustrates recent new restrictions on slot-names which > are probably unwanted (though the STYLE-WARNING is useful). > > > * (lisp-implementation-version) > "1.1.13.18-4c7c37b-dirty" > * (defstruct foo :bar) > STYLE-WARNING: > Keyword slot name indicates probable syntax error in DEFSTRUCT: :BAR. > debugger invoked on a SB-PCL::SLOTD-INITIALIZATION-ERROR in thread > #<THREAD "main thread" RUNNING {1002ABB0D3}>: > Invalid SB-MOP:SLOT-DEFINITION initialization: the initialization argument > :NAME was constant: :BAR. > See also: > AMOP, Initialization of Slot Definition Metaobjects Sorry for not testing earlier, but this affects CL-SNMP, cgn, and gbbopen. They no longer build on SBCL 1.1.13+. Zach |
From: Christophe R. <cs...@ca...> - 2013-11-15 09:11:20
|
Eric Marsden <eri...@fr...> writes: > The following illustrates recent new restrictions on slot-names which > are probably unwanted (though the STYLE-WARNING is useful). I'm going to relax this back to the previous state for structure slot names only; I'll push in a bit. > * (lisp-implementation-version) > "1.1.13.18-4c7c37b-dirty" > * (defstruct foo :bar) > STYLE-WARNING: > Keyword slot name indicates probable syntax error in DEFSTRUCT: > :BAR. It occurs to me that we could do better than this. What are the syntax errors that the current situation are catching? I think they're primarily from forgetting that the defstruct options need to be in a list with the name, i.e. (defstruct (foo (:constructor bar)) baz) somehow becoming (defstruct foo (:constructor bar) baz) or (defstruct foo :constructor bar baz) So, why don't we issue full warnings for those keywords which match defstruct options, and let the rest through silently? I suppose a full warning is unjustified given that the code is strictly speaking conforming, but it would seem that it might have been useful earlier. Given that someone who wants to use a slot named constructor can use (defstruct foo constructor) without any problems, is there a downside to the full warning? Cheers, Christophe |