tag:blogger.com,1999:blog-8288194986820249216.post7477865068897670432..comments2024-02-04T15:47:25.088-08:00Comments on Abstract Heresies: EQL SpecializersJoe Marshallhttp://www.blogger.com/profile/03233353484280456977noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-8288194986820249216.post-23085474835722512002012-12-30T22:00:29.742-08:002012-12-30T22:00:29.742-08:00That also is just a limitation of the CL class sys...That also is just a limitation of the CL class system.John Cowanhttps://www.blogger.com/profile/11452247999156925669noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-64757626652396761452011-01-13T13:09:47.313-08:002011-01-13T13:09:47.313-08:00John Cowan said... True that you might need such r...<a href="http://www.blogger.com/profile/11452247999156925669" rel="nofollow">John Cowan</a> said... <i>True that you might need such recursion on meta, but you only need it to the extent that you actually use it. And that's always possible...</i><br /><br />I'm not sure it <i>is</i> always possible because you may not have access to the class definition. If you didn't write the class definition, then you cannot (easily) insert an appropriate meta-class after the fact.Joe Marshallhttps://www.blogger.com/profile/03233353484280456977noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-42990589034330278262011-01-13T11:23:51.659-08:002011-01-13T11:23:51.659-08:00True that you might need such recursion on meta, b...True that you <i>might</i> need such recursion on meta, but you only need it to the extent that you actually use it. And that's always possible, because any standard class (including a metaclass) can have any descendant of standard-class as its metaclass. So in particular you need to make FooMeta be an instance of FooMetaMeta only if you are actually going to specialize on FooMeta at some point. Otherwise it can just be an instance of standard-class.John Cowanhttps://www.blogger.com/profile/11452247999156925669noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-50049449046193703272011-01-06T10:19:52.397-08:002011-01-06T10:19:52.397-08:00Nick Barnes said: Surely this isn't going to ...<a href="http://www.blogger.com/profile/00057838251997644583" rel="nofollow">Nick Barnes</a> said: <i>Surely this isn't going to work if anyone ever subclasses FOO? Messing about with programmer expectations like this is dangerous.</i><br /><br />Definitely true. In general, you probably don't need EQL specializers unless you are <br />cross-level meta-programming, discriminating on a tagged union (where the tag is essentially an ENUM and couldn't be logically subclassed), or have a domain in which you have explicitly added individual elements (much like a lifted domain).Joe Marshallhttps://www.blogger.com/profile/03233353484280456977noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-18273109276672844722011-01-06T02:52:23.870-08:002011-01-06T02:52:23.870-08:00Surely this isn't going to work if anyone ever...Surely this isn't going to work if anyone ever subclasses FOO? Messing about with programmer expectations like this is dangerous.Nick Barneshttps://www.blogger.com/profile/00057838251997644583noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-22250037123252960212011-01-05T10:45:39.016-08:002011-01-05T10:45:39.016-08:00You can certainly use EQL specifiers in an unprinc...You can certainly use EQL specifiers in an unprincipled way. I've seen the factorial function written such that the base case is handled by an EQL specializer on the number zero.<br /><br />I don't think you can completely sidestep EQL specializers by creating class singleton metaclasses, though. (Leave aside the non-class singletons.) CLOS is built upon several mutually recursive protocols. Some of these protocols are level-crossing (that is, they work at the meta-level to effect changes to the level). There would be infinite meta-recursion if you required that every specialization operated on the level above. <br /><br />In other words, by making the Foo class be an instance of the FooMeta metaclass, you have only pushed the problem back by one level. If you need to specialize on the FooMeta metaclass, then it would need to be a instance of the FooMetaMeta meta-metaclass, which would be an instance of the FooMetaMetaMeta meta-meta-metaclass and so forth. EQL specializers break this circularity.Joe Marshallhttps://www.blogger.com/profile/03233353484280456977noreply@blogger.comtag:blogger.com,1999:blog-8288194986820249216.post-66279602891696226442011-01-04T12:59:06.181-08:002011-01-04T12:59:06.181-08:00I admit these specializers are convenient, but I t...I admit these specializers are convenient, but I think they're unprincipled. If you want to match on Foo class itself, make it an instance of the FooMeta metaclass rather than the default metaclass. (Indeed, I don't know of any other use of metaclasses in CL.)<br /><br />Similarly, if you want to match on a non-class singleton, have a class of which that singleton is the sole member. I admit this is more awkward, as random singletons aren't typically CLOS objects, but that's a limitation of the CL type system.John Cowanhttps://www.blogger.com/profile/11452247999156925669noreply@blogger.com