hi, thanks.

you're absolutely right - the error is there (i just wrote a long message 
saying it wasn't, and then had to delete it, because it plainly is - i am 
not sure how i missed it).

i'll do what you suggest.

thanks again,
andrew


On Saturday, 31 October 2015 11:19:33 UTC-3, Michael Hatherly wrote:
>
> For user-defined macros you need to make use of Base.@__doc__ to mark the 
> subexpression returned by your macro that should be documented. In this 
> case it’s probably the Expr(:type, ...) that the docstring should be 
> attached to rather than the subsequent method definitions.
>
> So replacing the line 
> https://github.com/andrewcooke/AutoHashEquals.jl/blob/e3e80dfb190a8f8932fcce1cbdc6e4bcf79ea520/src/AutoHashEquals.jl#L81
>  
> with
> Base.@__doc__($(esc(typ))) 
>
> should be enough to allow documenting code generated via @auto_hash_equals. 
>
>
> There should have been an error message that points to the docs for 
> @__doc__, is that not showing up?
>
> It is available in v0.4 AFAIK.
>
> — Mike
>
> On Saturday, 31 October 2015 15:53:39 UTC+2, andrew cooke wrote:
>>
>>
>> I want to use the (relatively?) new docstrings, but have data structures 
>> that look like:
>>
>> """This is MyType."""
>> @auto_hash_equals type MyType
>>    attribute::Something
>> end
>>
>> where the macro comes from 
>> https://github.com/andrewcooke/AutoTypeParameters.jl
>>
>> unfortunately, this gives the error: LoadError: invalid doc expression 
>> (it seems that the docstring is being "applied" to the macro call, not the 
>> data type).
>>
>> and it's not clear to me what the best solution is.  should i modify my 
>> macros so that they can take a string, and then move the macro to before 
>> the string?  or is there something i can do that will make docstrings 
>> understand that it should be applied after the macro?
>>
>> thanks,
>> andrew
>>
>>
>>

Reply via email to