RE: [sv-ec] Mantis 1857 - extern method types for parameterized classes

From: Jonathan Bromley <jonathan.bromley_at_.....>
Date: Wed Jun 20 2007 - 09:37:59 PDT
Disclaimer:  this represents a somewhat naive point of view,
from one largely unschooled in the arcana of C++.
 
function::C makes absolutely no sense to me - the scope name
is on the wrong side of the :: token.
 
function #(type T) T C::foo(); similarly feels wrong. It's telling me
that T is a type, but T could hardly be anything else.  There is no
hint to the reader that T belongs inside C::
 
function #(type T=int) T C::foo();  looks suspiciously like an 
attempt to specialize C, and I'm sure it would be 
wrongly so used by many.
 
Personally I'm happiest with Gord's original suggestion
 
    C::function T foo();
 
To me it says, simply and clearly, that the entire function
definition is to be injected into the class C as if by cut-and-paste.
I have tried to follow Mike's objection but I don't really see
foo() as a templated function here; it acquires its parameterization
and any specialization from its enclosing class C, not from this 
external function body.  The syntax is indeed new, but it
doesn't hurt very much, does it?
 
However, I do accept Mike's point about the asymmetry of this
syntax.  Maybe it would make better sense to do something a 
little like namespaces in C++ as a way to parcel-up a bunch 
of external definitions - perhaps like this...
 
  C:: {  // everything inside {} is compiled as if inside C
    function T foo(); ... endfunction  // definition of C::foo
    task bar(); ... endtask  // definition of C::bar
  }
 
And <polite cough> that might provide a syntax hook for future
aspect-oriented extension...
 
Apologies if I'm miles off-base here.
-- 
Jonathan Bromley
 

-- This message has been scanned for viruses anddangerous content by MailScanner, and isbelieved to be clean.
Received on Wed Jun 20 09:38:54 2007

This archive was generated by hypermail 2.1.8 : Wed Jun 20 2007 - 09:39:02 PDT