Yes, in fact the code works without the macro using the Tuple{...} 
notation. The entire point of the macro is to make {...} = Tuple{...}, 
since in this use case it looks and feels very elegant. 

I felt that new Julia users would not immediately "get" the difference 
between Tuple types and tuples (instances), and I was hoping the package 
would be ammenable to newcomers. Currently I have a macro that converts [[ 
... ]] into what I want (it's a "indexing via metaprogramming" technique 
for tensor contractions/einsum... e.g. `A[Tuple{1,2}] = B[Tuple{2.1}]` 
gives matrix transpose, written like `@tensor A[[1,2]] = B[[2,1]]` in my 
current macro, and potentially as short as `A[{1,2}] = B[{2,1}]` in Julia 
0.5 notation where {} might equal Tuple{}. It's true that it is longer than 
`A = B.'`, but this generalizes nicely for arbitrarily complex tensor 
contractions and permutations). 

Andy



On Thursday, August 27, 2015 at 7:59:51 PM UTC+2, Yichao Yu wrote:
>
> On Thu, Aug 27, 2015 at 6:44 AM, Andy Ferris <[email protected] 
> <javascript:>> wrote: 
> > I'm writing a macro (for Julia 0.4) that is trying to take over the {} 
> > syntax and do something special (related to tensor contraction) but I 
> notice 
> > the code to the macro go's through parse() (or similar) before being 
> parsed 
> > to my macro function, which means I get deprecation warning for {} as 
> Julia 
> > 0.3 meaning a constructor to Array{Any} but no longer for later 
> versions. 
> > 
> > Is there a way to deactivate the deprecation warning, in general? 
> > 
> > Is there a way to deactivate the deprecation warning, just for a 
> specific 
> > macro? Is there any control macros have over parsing behaviour in 
> general, 
> > or could receive the raw text (without the end user needing to quote in 
> a 
> > string)? 
> > 
> > As a side note, if Jeff Bezanson's suggestion to use {} as Tuple{} in 
> Julia 
> > 0.5 is taken up, then I won't even need the macro, which is my 
> motivation 
> > for attempting to use this syntax now... 
>
> I this case, why not just use `Tuple{}`. sth like `@braces_as_tuple 
> {}` won't be so much easier to write then `Tuple{}` (even if your 
> macro has a more elegant/shorter name), especially since I don't think 
> `{}` get's it's own expression type in `0.4`. 
>

Reply via email to