ariatemplates / usermanual

This repo holds the articles for ariatemplates.com/usermanual (text content only)
http://ariatemplates.com/usermanual/latest/
5 stars 18 forks source link

A class can't inherit from the class with same last part of the name #61

Closed mraji closed 10 years ago

mraji commented 10 years ago

AT classes with same name and different classpaths are triggering an error in Aria template.

example of failling code :

Aria.classDefinition({
    $classpath : 'snippets.core.classes.Fruit'
});   

 Aria.classDefinition({
    $classpath : 'snippets.core.test.Fruit',
    $extends : 'snippets.core.classes.Fruit'
});   

It seems that this behaviour is normal, but it seems that it is not specified in the documentation.

Can you please check and add it ?

Regards, Marouane.

jakub-g commented 10 years ago

It was not clear initially for me, but now I got it.

It's about inheritance and indeed, if the last part of the classpath (Fruit in this case) is the same, then the inheritance fails. It should be documented

jakub-g commented 10 years ago

It actually seems that due to https://github.com/ariatemplates/ariatemplates/blob/v1.4.16/src/aria/Aria.js#L1215 it's impossible to name a class in a way that any of it's superclasses in the chain is named.

So when we have a class something.Foo, something.Bar which extends Foo, then a class in package whatever.XXX which extends Bar, can't be named neither Foo nor Bar. Actually I think it's a bit artificial restriction... Probably put in place due to impossibility to call the parent constructor via this.$Foo.constructor.