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

World: r3wp

[!REBOL3-OLD1]

BrianH
7-Aug-2009
[16522x3]
READ/text wasn't my proposal, it was Carl's. I often write the CureCode 
tickets for other people's requests, if they are good ones.
Pekr, expect the number of visible mezzanines to go down after the 
module system is fixed. The code is written already, but we are waiting 
for the plugin-related mezzanine changes before the overall module 
system changes can be merged in.
Louis, there may be a solution to your problem that involves direct 
port access, rather than a READ refinement...
Louis
7-Aug-2009
[16525]
Thanks for the feedback, everybody.  Brian, I'll check into direct 
port access.
Graham
8-Aug-2009
[16526x2]
Request ... I would like now/time to always return the seconds.
Edge conditions every exact minute are annoying...
Sunanda
8-Aug-2009
[16528]
Annoying isn't it? Have you submitted a wish to curecode.org?

For now, I use something like this:
    reduce [x: now/time x/hour x/minute x/second]
    ==[12:30 12 30 0]
Graham
8-Aug-2009
[16529]
no, I'd thought I'd solicit opinions first!
Sunanda
8-Aug-2009
[16530]
I think its a good idea!
Graham
8-Aug-2009
[16531]
I just spent a few hours trying to debug someone else's code ... 
and this was the cause.
Henrik
8-Aug-2009
[16532x2]
I agree. Good idea.
however one can use:

to-itime 11:2
== "11:02:00"
Pekr
8-Aug-2009
[16534x3]
to-integer now-time
eh, to-integer now/time ... does it return seconds? I think so ...
I am against now/time returning seconds - it shoul stay "human readable" 
....
Henrik
8-Aug-2009
[16537]
perhaps Graham should explain what the bug was and how he fixed it. 
I have had problems with it too.
Anton
8-Aug-2009
[16538]
I prefer consistency. Consistency makes it more easily human readable, 
despite all these "humanizing" algorithms. So I support Graham's 
request.
Graham
8-Aug-2009
[16539x2]
Henrik, I had forgotten about to-itime, but it looks quite inefficient


>> t1: now/precise loop 10000 [ copy/part join next form 100:00 + 
t ":00" 8 ] difference now/precise t1
== 0:00:00.073

>> t1: now/precise loop 10000 [ to-itime t ] difference now/precise 
t1
== 0:00:00.32
Personally I think it should always display the seconds, and we can 
trim it to remove it for display purposes.
Henrik
8-Aug-2009
[16541]
to-itime is only really good for consistently printing time, for 
example for a running clock.
Graham
8-Aug-2009
[16542]
Well, it is supposed to be used for forming internet time strings.
Sunanda
9-Aug-2009
[16543]
How can I check if a word exists without incidently creating an entry 
in the word table for it?
eg this does not work as the act of finding creates the word:
    find words-of system/contexts/user 'no-such-word
    == [no-such-word]
Gabriele
9-Aug-2009
[16544x2]
Graham, you're actually asking for mold and form to always include 
seconds... which is something i think i agree with, though, it would 
be much better to finally have FORMAT for all these things.
Sunanda, I haven't checked, but to word! with a string might work, 
as it does not bind.
PeterWood
9-Aug-2009
[16546]
Slowly like this :

>> probe words-of system/contexts/user
[system a words-of contexts user to string! find context probe]

== [system a words-of contexts user to string! find context probe]

>> find to string! words-of system/contexts/user "no-such-word" 
== none

>> probe words-of system/contexts/user                          
[system a words-of contexts user to string! find context probe]

== [system a words-of contexts user to string! find context probe]
Henrik
9-Aug-2009
[16547]
perhaps that should be simplified
Sunanda
9-Aug-2009
[16548]
Thanks...


Peter -- that was more-or-less the best solution I had. I was hoping 
for something better.


Gabriele -- that seems to work! I'm sure I'd tried it, and it hadn't 
worked for me when I tried it......But it does now. Nice!

I think I got confused because it _seems_ to work of R2 but does 
not:
    find first system/words to-word "really-no-such-word"
    == none
     last first system/words
    == really-no-such-word
Whereas, it really does seem to work on R3.
PeterWood
9-Aug-2009
[16549x2]
Isn't the difference between R2 and R3 because words are automatically 
bound to the global context in R2 but are not automatically bound 
to any context in R3.
.... not all words ..just those that are forned with to:

>> probe words-of system/contexts/user
[system probe words-of contexts user]
== [system probe words-of contexts user]

>> 'my-word
== my-word
 
>> probe words-of system/contexts/user 
[system probe words-of contexts user my-word]
== [system probe words-of contexts user my-word]

>> to word! "your-word"
== your-word

>> probe words-of system/contexts/user 
[system probe words-of contexts user my-word to word!]
== [system probe words-of contexts user my-word to word!]
Anton
9-Aug-2009
[16551x2]
I would suggest, for R3:

 foreach word words-of system/contexts/user [if "my-word" = form word 
 [break/return word]] ; <-- untested.
Seems to work.
BrianH
9-Aug-2009
[16553]
Note that system/contexts/user is not the word table, as system/words 
is in R2. The actual word table in R3 is an internal native thing.
Sunanda
9-Aug-2009
[16554]
Thanks for the clarification.

Can we test if a word exists without creating a junk entry in the 
internal table?
BrianH
9-Aug-2009
[16555x2]
find mold words-of some-context-or-object "word-you-are-looking-for"
Expect it to be slow, at least relatively.
You probably don't need to worry about creating entries in the symbol 
table though. Word lookup is constant-time, and there is no effectve 
upper limit to the number of words it can hoid - you'll run out of 
memory in a 32bit address space first :)
Sunanda
9-Aug-2009
[16557]
The limit is much relaxed compared to R2 where long running large 
applications needed some very careful word hygiene to not bust the 
2000 [then 4000 then 8000] limit.

But there is documented R3 limit of around 500,000:
http://www.curecode.org/rebol3/ticket.rsp?id=587
BrianH
9-Aug-2009
[16558]
Ah, I had forgotten about that (thanks).
Pekr
10-Aug-2009
[16559]
Plugins vs plugin blog - make your vote .... http://www.rebol.net/r3blogs/0230.html
Gabriele
10-Aug-2009
[16560]
Sunanda, latest R2 should be limited at 32k words.
Sunanda
10-Aug-2009
[16561]
Thanks Gabriele. 32K is getting useful. Sadly, for me. I support 
an elderly View system with a limit of 4100 (or so) words. It gets 
tricky at times :) (I guess we;re off topic for R3 here)
RobertS
10-Aug-2009
[16562x4]
I just discovered that rebol3 can escape a forward curly brace as 
in  str: {text^{}
Is there any way to get  ^{ as an escape comparable to ^}  into rebol2.7.6 
?  2.7.7 ?  Otherwise generating string comtaining both dbl-quote 
" and curly-braces seems quite maddening ...  when using REBOL on 
server-side what is easy in PHP or PERL is suddenly a challenge ... 
or am I missing something about wrapping strings in curly braces 
?
My problem   token:  join  { ^{ text color = "red", name = "test1" 
}  [ token2 token3 ] ; when first value has many options and is spread 
across multiple lines for readability, the string value requires 
curly braces; token  is ok to be   token3:  { some text  values and 
then clsing escaped curly brace^} }
I see no change recorded at http://rebol.com/r3/docs/datatypes/string.html
   Is there really no hope of   {" folowed_by_space then whatever 
chacters I please _ending_with_space _before "}   or some such as 
  {~ space_before_text_then_ending_space_before ~}     It is so odd 
that for our emphasis on value that a string containing  a linefeed 
and an odd number of braces is an error.  After all,   an odd number 
of colons is not an error !   Why MUST we escape characters rather 
than allowing true LITERAL string values ?  We even allow semi-colon 
within braces without an escape !  ;comment anyone?
btiffin
10-Aug-2009
[16566]
Robert.  { ^(7B) ^(7D) }   ?? Maybe?
BrianH
10-Aug-2009
[16567]
Sounds interesting. A few comments:

- Colons and semi-colons don't have special meaning within REBOL 
string literals - { and " do (depending on how they are specified).

- String literals in programming languages almost always have escaping, 
though the capabilities vary from language to language. Escaping 
is done to include data in the string that would otherwise break 
the syntax. Without escaping you will never be able to include certain 
characters or character sequences.


There's a lot of terms and methods for what you are asking for, such 
as here docs (from Perl), CDATA sections (from XML), etc. An interesting 
idea, though it is usually cause for concern when we look to Perl 
or XML for syntax ideas - that's usually a bad road to take. Remember, 
when you get rid of escaping you limit the characters (or sequences) 
that you can include, though with here docs that limit can be minimal.
Gabriele
11-Aug-2009
[16568x2]
Robert, don't be fooled by R2's buggy console. R2 can escape { just 
fine - it's the console that will wrongly think you have an open 
string. Try that in a .r file.
or try:

>> b: load "{ ^^{ }"
== " { "
Oldes
11-Aug-2009
[16570x2]
I totally understand what Robert means... escaping like Brian T. 
or Gabriele shows is crazy if you work with C/PHP/JS-ish sources 
inside REBOL
I thing theere should be whish in CureCode at least.