r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

BrianH
16-Oct-2010
[58x2]
Let's also stick to text. No binary data in our strings.
Some languages have raw binary heredocs, but that doesn't work well 
with Unicode strings, nor does it post in text mode well.
Ladislav
16-Oct-2010
[60]
Agreed, I do not see any need to have binary heredocs
james_nak
16-Oct-2010
[61]
maxim - regarding namespaces: Are you kidding? I'm not even going 
to touch those. My excuse is if xml-object.r can't handle it, neither 
will I. :^(
Oldes
16-Oct-2010
[62x2]
Because it's complicated? Heredoc is enough for me and I'm lucky 
I'm not alone who found it missing.
oh.. my message is reply to Gramam's:

@Ladislav ... the { } only have special significance because the 
interpreter is so written ...  so why not make it user definable 
?
I've not noticed I'm not at the end of the chat :/
BrianH
16-Oct-2010
[64]
Three reasons:

- The { and } are not chosen at random, they are the consequence 
of using those characters to delimit strings themselves.

- There aren't many characters or character sequences that can be 
optional without conflicting with other stuff in the grammar.

- Syntax processors with user-defined stuff in them are much slower 
than ones without them.
james_nak
16-Oct-2010
[65]
Hi, I have a client whose ftp username has an ampersand @ in it. 
I think that's causing a problem accessing it. Is there a way around 
that or should that work?
Sunanda
16-Oct-2010
[66]
Try read (write etc) like this:

     read [ scheme: 'ftp host: domain.com user: user-domain.com pass: 
     "password" ]

Or see what other people have tried in the past:
    http://www.rebol.org/ml-topic-index.r?i=ftp
james_nak
16-Oct-2010
[67]
Thanks Sunanda. that was it.
Ladislav
17-Oct-2010
[68x3]
Regarding the "why the heredoc syntax was proposed" question, here 
is another reason, that is important for me, proving, that even users 
not planning to use other languages than REBOL can take advantage 
of it:


In my REBOL script files, I usually write code examples, or code 
tests, that are meant to demonstrate the newly defined functions, 
or to test whether they work as expected. That code is in no way 
meant to be run every time the script is run. Therefore, I use the 
COMMENT function to ensure the example/test code does not run every 
time the script is run.


Since it is a comment, I prefer to use a string to be able to write 
it "free-form" not being bound by the requirement of loadability 
of the text. However, when the code examples in the comment contain 
special "escaped characters", this would look ugly, therefore I rather 
give up the free-formness of the comment gaining the advantage of 
not being forced to escape the special characters, but being forced 
to keep the comment REBOL-loadable. The proposed heredoc syntax can 
solve this, and similar problems nicely and naturally.
(this property just "mimics" the property of the ; single-line comments, 
which does not need any character escaping as well)
Regarding the syntax name - if we want to use a scientific one, we 
can call the syntaxes "single-line syntax with escaping", "multi-line 
syntax with escaping", and "multi-line syntax without escaping".
Gregg
17-Oct-2010
[71x2]
I do the same thing as Ladislav with tests and comments, and having 
a separate HEREDOC func makes much more sense than a MOLD refinement. 
I'm still not keen on the name, but the scientific options are a 
bit long for func names. :-)

I'm fine with the tag being optional as well.


The discussion here, and comments on curecode, have addressed my 
current questions and concerns. Thanks to all involved for that, 
particularly Ladislav. I think it's absolutely worth a trial run 
to see if anything comes up in acutal use that isn't easily addressed 
with docs.
This also gives me more to think about with regard to how and why 
location markers might be done.
Ladislav
18-Oct-2010
[73x2]
Syntax names:

single-line syntax with escaping
 == "double-quoted"
multi-line syntax with escaping
 == "curly-braced"
multi-line syntax without escaping
 == "heredoc"
Actually, the "heredoc" name pretty well explains what is an area 
where it can be successfully used.
Maxim
18-Oct-2010
[75]
As the general conscensus stands I think this will be a GREAT addition 
to the syntax.   I've missed this notation in REBOL from the day 
I used other languages which have it.
Ladislav
18-Oct-2010
[76]
:-) I surely missed it before using other languages which have it. 
(since I did not use such a language yet)
Gregg
18-Oct-2010
[77]
- Single-line
- Multiline (at least that's the term used up to now)
- Heredoc, Raw, Unescaped  ???
Maxim
18-Oct-2010
[78]
what's the termed generally used for <pre> </pre> tags in html?
Sunanda
18-Oct-2010
[79]
pre-formatted?
Gregg
18-Oct-2010
[80]
Preformatted text.

I like it.
Maxim
18-Oct-2010
[81x2]
yeah, I think its a bit more human understandable... text appears 
"as-is" .
it also seems natural to say that when files are read, they are pre-formatted.
Oldes
18-Oct-2010
[83]
The functionality is different. If PRE tag would be woking as heredoc, 
than it would display all tags without need to escape < to &lt;
Maxim
18-Oct-2010
[84x3]
yes, but this is a string format, not a rich-text format.  so the 
only formatting you can give it lines, tabs & spaces.
pre tag should always have had a  tag=""  paramter which allowed 
it to skip html content until it found a closing <pre> tag with the 
same tag attribute (my 2 cents).
also, historically R2 view had the "as-is" identifier which meant 
to preserve the formatting, but it was still limited to the language's 
lexical parser... this could be used instead. 


meaning roughly... don't interpret the stream of bytes as containing 
any codes, just use it as a stream of characters  "as-is"..
Ladislav
18-Oct-2010
[87]
Nevertheless, Oldes is right, that <pre> uses escaping, so it is 
not analogical to heredoc in this respect
Maxim
18-Oct-2010
[88x2]
yes... I am trying to say we are doing  <pre> ... </pre>   since 
its roughly equivalent to  { ... }
*not trying*
Ladislav
18-Oct-2010
[90]
(or, I should say to the heredoc syntax I am proposing, since it 
seems, that some heredocs use some escaping)
Maxim
18-Oct-2010
[91]
I'm just saying that "pre-formatted" is a nice differentiating term:

single-line, multi-line & pre-formatted.
Andreas
18-Oct-2010
[92x3]
single-line, multi-line, heredocs
Please stop fussing over the name and just stick with heredoc, which 
is a widely used and well-established notion.
Heck, there's even a Wikipedia page on it: "A here document (also 
called a here-document, a heredoc, a hereis, a here-string or a here-script) 
is a way of specifying a string literal"
ChristianE
18-Oct-2010
[95]
Seconded, there is exactly *no* reason I can think of to give heredoc 
like strings a name other than "heredoc" string. Even stackoverflow.com 
features a heredoc tag.
GrahamC
18-Oct-2010
[96x2]
all the more reason to be different!
sorry .. that's the rebolish way
Gregg
18-Oct-2010
[98]
Ultimately, Carl will choose. All we can do is weigh in with our 
votes, and cite what we think justifies our postiion. ;-) I will 
only say that "heredoc" brings to mind the following scene from Young 
Frankenstien:

Inga: Werewolf! 
Dr. Frederick Frankenstein: Werewolf? 
Igor: There. 
Dr. Frederick Frankenstein: What? 
Igor: There, wolf. There, castle. 
Dr. Frederick Frankenstein: Why are you talking that way? 
Igor: I thought you wanted to. 
Dr. Frederick Frankenstein: No, I don't want to. 
Igor: [shrugs] Suit yourself. I'm easy.
BrianH
18-Oct-2010
[99x4]
The closest thing to a heredoc in html is a cdata section.
Not a pre.
And finally, it doesn't matter what we call it. The names of these 
syntax types won't appear in code, just in docs. So stick to the 
standard.
Graham, the REBOL way is to rename things if there is a good reason 
to do so, not just at random :)
Sunanda
19-Oct-2010
[103]
Actually, I think a pre is closer to heredoc than CDATA.
CDATA is strictly speaking for XML or XHTML. not HTML.

And CDATA only, in effect, protects unescaped <, > and & from being 
interpreted as mark-up.

Perhaps, more importantly for the heredoc issue, whitespace is not 
guaranteed to be left as-is in CDATA:
   http://www.w3.org/TR/html4/types.html#h-6.2
But it certainly does not matter to me what we call it :)
GrahamC
21-Oct-2010
[104x2]
Regarding order of function parameters ... eg.  REPLACE target search 
replace /all /case /tail


it's probably not as intuitive to read ... but if you had  REPLACE 
search replace target /all /case /tail

this would aid processing the output of other functions

So, instead of 


replace some series of functions here which returns a string but 
I've got to end this stream with replace target

I could do


replace  replace target   some series of functions here which returns 
a string but I've got to end this stream with
with the aim of passing the output of one function to another in 
a chain
Anton
21-Oct-2010
[106]
Graham, I agree.
GrahamC
21-Oct-2010
[107]
Or, how about a switch that allows you to change the order of the 
arguments?