Is this a valid @pure function?

question

#1

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


#2

I’d say “yes”.

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


#3

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)

awesome!!!


#4

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