On Wednesday, September 28, 2016 at 11:46:32 AM UTC-10, Shrutarshi Basu 
wrote:
>
>
> This is suboptimal because I am writing the title and the URL as strings 
> and packing them into the Racket arguments component. Ideally, I would like 
> to be able to write something like:
>
> ◊essay[Title](http://url-to-this-essay.html){The blurb for this essay}
> <http://twitter.com/basus>
>


Pollen borrows its syntax from the Scribble language, and this is a 
limitation of Scribble syntax. I've made this same suggestion on a couple 
occasions, most recently last week. Here's the explanation from Scribble's 
designer why he didn't do it that way:

https://groups.google.com/d/msg/racket-users/tv6ENRkG7tg/9QwNwdyFDgAJ 

I've come to think of it as analogous to an XML tag that has attributes at 
the front, and then the rest.

Your solution will work:

> ◊essay{
> ◊title{Title} 
> ◊url{http://url-to-this-essay.html}
> ◊blurb{The blurb for this essay}
> }


So would something like this (because ◊-expressions can appear anywhere)

◊essay[
#:title "Title" ;; or ◊list{Title} if this should be a full X-expression
#:url "http://url-to-this-essay.html";
#:blurb ◊list{The blurb for this essay}
]

Or a blend of these two:

◊essay[
"Title"
"http://url-to-this-essay.html";
]{The blurb for this essay}

◊essay[
#:title "Title"
#:url "http://url-to-this-essay.html";
]{The blurb for this essay}

This would also work:

◊essay{
Title
http://url-to-this-essay.html
The blurb for this essay
}

If you attach to `essay` a mini-decoder that unpacks these as "positional" 
arguments.



-- 
You received this message because you are subscribed to the Google Groups 
"Pollen" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to