# Trojan horse types - a type that takes over the function calling it

**URL:** <https://discourse.julialang.org/t/trojan-horse-types-a-type-that-takes-over-the-function-calling-it/31731>\
**Category:** Internals & Design\
**Created:** [December 2, 2019, 1:50am UTC](https://discourse.julialang.org/t/trojan-horse-types-a-type-that-takes-over-the-function-calling-it/31731 "2019-12-02T01:50:00Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Post date:** [December 2, 2019, 11:16pm UTC](https://discourse.julialang.org/t/trojan-horse-types-a-type-that-takes-over-the-function-calling-it/31731/21 "2019-12-02T23:16:03Z")

</div>

I had another bad bad half baked idea…

start with something like this:

```julia
abstract type GhostArray{F <: Base.Callable, T, N} <: AbstractArray{T, N} end

```

Where F is materialize or whatever hook you want…

but trick julia into thinking it’s a collection or iterator, so it will collect each value.

So basically make the parent type an abstractiterator or abstractrange. I think that’d be one easy way, but, it would not have the same functionality as an array…

[Previous page](https://discourse.julialang.org/t/trojan-horse-types-a-type-that-takes-over-the-function-calling-it/31731.md?page=1)
