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

A bug or a feature?

 [1/6] from: carl::cybercraft::co::nz at: 3-May-2001 20:36


Can someone tell me why I get an error in the second example here...
>> test: [a: text "hello"]
== [a: text "hello"]
>> view layout [panel test 200x50]
That works fine with no errors, but if I use to-block on a string to attempt to produce the same test block, I get this...
>> test: to-block {a: text "hello"}
== [a: text "hello"]
>> view layout [panel test 200x50]
** Script Error: a is not defined in this context ** Where: forever ** Near: set :var new new/var: to-word Now, I've worked out that 'a isn't being set when to-block is used, unlike in the first example, but is that's what's supposed to happen? And if so, how would you convert a string to a block so the 'a: above would be set? -- Carl Read [carl--cybercraft--co--nz]

 [2/6] from: gchiu:compkarori at: 3-May-2001 21:26


On Thu, 03 May 2001 20:36:37 +1200 Carl Read <[carl--cybercraft--co--nz]> wrote:
> >> test: to-block {a: text "hello"} > == [a: text "hello"]
try test: load {a: text "hello" }
> And if so, how would you convert a string to a block so > the 'a: > above would be set?
-- Graham Chiu

 [3/6] from: carl:cybercraft at: 4-May-2001 0:12


On 03-May-01, Graham Chiu wrote:
> On Thu, 03 May 2001 20:36:37 +1200 > Carl Read <[carl--cybercraft--co--nz]> wrote: >> >> test: to-block {a: text "hello"} >> == [a: text "hello"] > try test: load {a: text "hello" }
Thanks Graham - that did the trick - and I never wouldn't thought to use load on a string... ! (:
>> And if so, how would you convert a string to a block so >> the 'a: >> above would be set? > -- > Graham Chiu
-- Carl Read [carl--cybercraft--co--nz]

 [4/6] from: jelinem1:nationwide at: 3-May-2001 7:42


FYI when using to-block, the block was being created (as data only), but in order for the assignment to happen it needed to be executed (as code). - Michael Jelinek Carl Read <[carl--cybercraft--co--nz]>@rebol.com on 05/03/2001 07:12:03 AM From: Carl Read <[carl--cybercraft--co--nz]>@rebol.com on 05/03/2001 07:12 AM Please respond to [rebol-list--rebol--com] Sent by: [rebol-bounce--rebol--com] To: [rebol-list--rebol--com] cc: Subject: [REBOL] Re: A bug or a feature? On 03-May-01, Graham Chiu wrote:
> On Thu, 03 May 2001 20:36:37 +1200 > Carl Read <[carl--cybercraft--co--nz]> wrote: >> >> test: to-block {a: text "hello"} >> == [a: text "hello"] > try test: load {a: text "hello" }
Thanks Graham - that did the trick - and I never wouldn't thought to use load on a string... ! (:
>> And if so, how would you convert a string to a block so >> the 'a: >> above would be set? > -- > Graham Chiu
-- Carl Read [carl--cybercraft--co--nz]

 [5/6] from: carl:cybercraft at: 4-May-2001 8:16


On 04-May-01, [JELINEM1--nationwide--com] wrote:
> FYI when using to-block, the block was being created (as data only), > but in order for the assignment to happen it needed to be executed > (as code). > - Michael Jelinek
I knew it was something like that, but it's hardy intuitive that 'to-block isn't the same as creating a block in the normal manner. As to 'load, I thought it chose the type based on the type the file had been saved as, so I would expect a string to stay a string. I'd seen someone say use 'load instead of 'read to achieve this, but I guess I'd better read up on the details of 'load... -- Carl Read [carl--cybercraft--co--nz]

 [6/6] from: jelinem1:nationwide at: 3-May-2001 15:59


I was introduced to 'load to replace using "do read". Since 'load also takes strings and blocks, it can also replace "do to-block". - Michael Jelinek On 04-May-01, [JELINEM1--nationwide--com] wrote:
> FYI when using to-block, the block was being created (as data only), > but in order for the assignment to happen it needed to be executed > (as code). > - Michael Jelinek
I knew it was something like that, but it's hardy intuitive that 'to-block isn't the same as creating a block in the normal manner. As to 'load, I thought it chose the type based on the type the file had been saved as, so I would expect a string to stay a string. I'd seen someone say use 'load instead of 'read to achieve this, but I guess I'd better read up on the details of 'load...