[Grace-core] Fwd: Some notes on pattern matching on the wiki

James Noble kjx at ecs.vuw.ac.nz
Tue Jul 5 05:42:18 PDT 2011


> (I've only had half an eye on the discussion so apologies if I've missed the point somewhere.)

no problem, and you don't seem to have missed it...

> I went through a phase in my early days of Java programming when I used "this" for all self calls (and access to fields) only to find it totally was wrong in the context of nested classes.

Hmm.. ?

> So what is the graceful view of nested classes anyway?

not sure yet. I think we are close to committing to something close to gBeta/Newspeak/ (Ceylon?) view 
but haven't hurtled over that waterfall quite yet..

that is - yep classes nest, modules are nested classes, class family inheritance (overriding inner classes in subclases) works right...

> But I do like the idea of an explicit self. I speculate that it would make places where the self call results in code in a descendent class to be invoked (aka template methods). If the responses I got to a question on this in the exam I marked last week is anything to go by, students need some sort of help getting their heads around this. An explicit receiver might help (and you know I don't like implicit things).

yes and yes.

One thing - having just posted a long-overdue blog message on encapsulation - 

is that if say we went for method requests starting with "_" being object-private.

how ugly is it to have to write self._foo  and self._bar(x,5) all the time to access "private" stuff? 

other "conventions"  - markers on defintions, or e.g. caps => public, don't look so ugly but have other issues.

(an evil option could allow "_" as a substitute for "self." for private things, but that seems several more steps too far)

James


More information about the Grace-core mailing list