[Grace-core] typeof/decltype/getType as alternaties to generic methods?
James Noble
kjx at ecs.vuw.ac.nz
Wed Nov 19 22:52:02 PST 2014
On 20/11/2014, at 18:47 pm, Marco Servetto <marco.servetto at gmail.com> wrote:
> I have some problem to understand this typeof issue.
> to have a map method, why do not just do the following:
that's all fine if so long as you're inside your Map class.
not so fine if all you'ev got is a list and want to do stuff like this
def myList ; List[Product]
myList.map { each -> print (each) }
print "total price = sum(myList.map{ each -> each.price })
without having to write the result of type the block each time,
and without having to give up type checking
J
More information about the Grace-core
mailing list