On 23.04.2016 21:49, xtreak wrote:
I am a D newbie from Python and I am trying to grok alias. Is alias like
Python does as below
L = []
myextend = L.extend
L.myextend
My Python isn't too great, but I think this is more similar to function
pointers or delegates in D.
Renaming imported function
from itertools import permutations as p
p([1, 2], 2)
Yes, that's similar. A renamed import creates an alias. For example,
`import std.algorithm: p = permutations;` creates an alias `p` for
std.algorithm.permutations.
Is D aliasing the same as above? How does aliasing types help like below
alias intList = LinkedList!int
Is the above like a partially applied template as in LinkedList!int([1,
2, 3]) and hence can I use it like intList([1, 2, 3])?
No, the template isn't partially applied, it's fully instantiated (and
results in a type). The alias declaration just makes `intList` an
alternative name for `LinkedList!int`.