I didn't mean first-class. I did mean "only runtime". In python it is hard to check (no macroses...). But in Common Lisp, top-level defclass is accessible during macro-expansion.
In Scala and Nemerel AFAIK classes also are accessible (with introspection) from macros body. Thu, 3 Apr 2014 10:58:40 -0400 от Matthias Felleisen <[email protected]>: > >On Apr 3, 2014, at 9:12 AM, Roman Klochkov < [email protected] > wrote: > >> > classes in Racket are themselves *runtime* values >> >> Thank you. Now I understand. I don't remember any language with classes, >> except Racket with such feature. > >It turns out almost all dynamically typed languages treat class in a >first-class manner. Here is an example: > >class C1(object): > def __init__(self): pass > def m(self): return "c1" >class C2(object): > def __init__(self): pass > def m(self): return "c2" ># f is a mixin, result inherits from C >def f(C): > class Sub(C): > def __init__(self): pass > def n(self): return self.m() > return Sub >c1cls, c2cls = f(C1), f(C2) > >[due to Sam TH] -- Matthias > > > >[[ p.s. > > >> Usually, either a class is a type, so it is defined in compile-time, or >> there no classes at all and objects just built on a prototype. > >Spiritually equating classes with types is a mistake. But yes many explicitly >and statically typed languages do so. ]] > -- Roman Klochkov
____________________ Racket Users list: http://lists.racket-lang.org/users

