Is this a valid @pure function?

Hi julia pros,

is the following function safe to be annotated with @pure?

Base.@pure getParameters(t::Type) = Tuple{t.parameters...}

it would be soo awesome, because this indeed supports type inference

1 Like

I’d say “yes”.

(I’d also say the function should be named getparameters or get_parameters.)

thanks a lot,

(the name just came from my daily Scala work… of course in julia style guide your suggestions or e.g. parametersof are preferable)


I believe the function should infer fine without @pure also.

1 Like