On Tuesday, October 6, 2015 at 10:17:27 AM UTC-4, Páll Haraldsson wrote:
>
> On Monday, October 5, 2015 at 7:34:43 PM UTC, Matt wrote:
>>
>> Most of the time I read Julia code with generated functions, the goal is 
>> loop 
>> unrolling <https://en.wikipedia.org/wiki/Loop_unrolling> (included the 
>> main example in the documentation 
>> <http://julia.readthedocs.org/en/latest/manual/metaprogramming/#generated-functions>
>> ).
>> What are other good cases to use @generated functions?
>>
>
> I (think I) understand the (hygenic) macro (Lisp-like) concept, and kind 
> of, generated functions (I understand that those are macros on steroids..).
>

Macros are functions evaluated at *parse time*, given the *symbolic* 
expressions (ASTs) of the arguments and returning a transformed expression. 
 Generated functions are functions evaluated at *compile time*, given the 
*types* of the arguments and returning a symbolic expression.  Ordinary 
functions are functions evaluated at *runtime*, given the *values* of the 
arguments and returning a value. 

Reply via email to