Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: another tag! issue

From: joel:neely:fedex at: 26-Jan-2002 17:40

Hi, Hallvard, There's more consistency that meets the eye, just not well documented... Hallvard Ystad wrote:
> Hi again > > OK, so I accept that RT wants all characters in tags to be > accessible, so that <a href=""> and <a href = ""> are not > alike. But how about this: > > >> print <a href=""> > <a href=""> > >> print join <a href=""> "^/" > <a href="" > > > >> > > It seems JOIN <a href=""> "^/" puts in the linebreak too early. >
Think of TAG! as a subtype of STRING! which uses < and > as its delimiters instead of " and " or { and } . Consider this console transcript, which makes it clear that the corner-brackets are the syntax that identifies a tag, but are not part of the tag's data content:
>> foo: <a href="">
== <a href="">
>> foreach item foo [print item]
a h r e f " " Now let's try another example:
>> baz: join foo { border="0"}
== <a href="" border="0"> which shows that JOIN (as well as the other series operations, including APPEND, etc.) will operate on the *data*content* of the tag, which doesn't include the delimiters. I simply used a printable string instead of the whitespace value of "^/" to make the illustration more visible. After all, if I wrote foo: {a href=""} and then evaluated join foo "###" you'd expect to get a result which would MOLD something like {a href=""###} instead of {a href=""}### wouldn't you?
> Or am I mistaken again? If I FORM or MOLD the TAG!, it seems > to work fine... >
But the effect of FORM or MOLD is to manufacture a STRING! value from other data types. It just happens that the external format for a TAG! value is always bracketed with the < and > to make it clear that we're dealing with something other than a plain string. HTH! -jn- -- ; sub REBOL {}; sub head ($) {@_[0]} REBOL [] # despam: func [e] [replace replace/all e ":" "." "#" "@"] ; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"} print head reverse despam "moc:xedef#yleen:leoj" ;