That's really quite nice and for the purpose of interfacing with JSON is 
certainly clearer. 

On Thursday, September 3, 2015 at 4:40:54 PM UTC-4, Mike Innes wrote:
>
> FWIW I mocked up a json syntax macro:
>
> using MacroTools, Lazy
>
> import MacroTools: prewalk
>
> function prockey(key)
>   @capture(key, (a_:b_) | (a_=>b_)) || error("Invalid json key $key")
>   isa(a, Symbol) && (a = Expr(:quote, a))
>   :($a=>$b)
> end
>
> function procmap(d)
>   @capture(d, {xs__}) || return d
>   :(Dict{Any, Any}($(map(prockey, xs)...)))
> end
>
> macro json(ex)
>   @>> ex prewalk(procmap) esc
> end
>
> Michael's original example becomes:
>
> data = @json {
>         displayrows: 20,
>         cols: [
>                     { col: "l1" },
>                     { col: "l2" },
>                     { col: "l3" },
>                     { col: "num", display: true },
>                     { col: "sum", display: true, conf: { style: 1, func: { 
> method: "sum", col: "num"  } } }
>                 ]
>       # ...
>     }
>
> You might argue that it's actually nicer than the original.
>
> On Thu, 3 Sep 2015 at 21:22 Scott Jones <scott.pa...@gmail.com 
> <javascript:>> wrote:
>
>> Another use is marking off the keyword arguments or parameters.
>>
>>
>> On Thursday, September 3, 2015 at 3:11:34 PM UTC-4, Jonathan Malmaud 
>> wrote:
>>>
>>> What are the other uses of ; in Julia? I can only think of suppressing 
>>> output on the REPL and separating expressions on a single line - neither 
>>> seems inconsistent or really related at all to the use within []. 
>>>
>>> On Thursday, September 3, 2015 at 3:06:22 PM UTC-4, Scott Jones wrote:
>>>>
>>>>
>>>>
>>>> On Thursday, September 3, 2015 at 1:47:07 PM UTC-4, Sean Marshallsay 
>>>> wrote:
>>>>>
>>>>> [1:10;] is simply a consequence of matrix literal syntax (like [1:10; 
>>>>> 11:20]) and gets translated into vcat(1:10). It might be a bit confusing 
>>>>> but there's no point in making it a special case
>>>>>
>>>>
>>>> Yes, I understand that, and that too is not consistent with the use of 
>>>> ; outside of [ ].
>>>> spaces, colon, semicolon, and commas are all treated specially instead 
>>>> of [ ], which can be rather confusing.
>>>> Some of that special behavior is being deprecated, but some remains.
>>>>  
>>>>
>>>

Reply via email to