On Thu, Nov 17, 2011 at 10:40 AM, David Herman <[email protected]> wrote:
> This isn't about scope, it's about at what point they're initialized. If you
> write:
>
> let x = new C();
> let C = class /* whatever */;
>
> you won't get a scope error but a runtime initialization error. Whereas if
> you write:
>
> let x = new C();
> class C { ... }
>
> it'll work fine.
>
> I'm with Arv 150% on this.
I'm with Allen. If ES classes can contain any initialization code, I
think it should run in program order, interleaved with top-level
statements. Anything else is just confusing.
Note that classdefs in Ruby and Python aren't hoisted, and nobody
complains. In those languages classdefs very often contain procedural
code, for many purposes.
class Card # Ruby
attr_accessor :rank, :suit # macro-like
end
class File: # Python
size = property(get_size) # create property descriptor
if os.name == 'posix': # ifdef-like
... posix-only methods ...
-j
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss