REBOL Developer Network

Version 2.7.2 - Mezzanine update, SWITCH change

Carl Sassenrath, CTO
REBOL Technologies
25-Nov-2006 22:18 GMT

Article #0008
Main page || Index || Prior Article [0007] || Next Article [0009] || 56 Comments || Send feedback

Purpose

To make fixes and critical enhancements to mezzanine functions and protocols that have been submitted by REBOL users.

REBOL Test Versions - Download Archive

Possible Unstable Release
  • This release is essentially untested.
  • The stability of this release is not proven.
  • Do not use this release for mission critical applications.
  • Use at your own risk.

Details

  • RAMBO Changes
    Listed separately in section below.
  • SWITCH Function Changed
    SWITCH function is now native, and adds two important features: 1) evaluates the first block found after the switch case value, 2) adds the /all refinement to evaluate all matching cases. See example section below.

SWITCH Discussion

Here are examples to show the new SWITCH behavior:

>> val: 'a
>> switch val [a b [print 'xx] c [print 'yy] d]
xx
>> val: 'b
>> switch val [a b [print 'xx] c [print 'yy] d]
xx
>> val: 'c
>> switch val [a b [print 'xx] c [print 'yy] d]
yy
>> switch val [a b c [print 'xx] c [print 'yy] d]
xx
>> switch/all val [a b c [print 'xx] c [print 'yy] d]
xx
yy
>> val: 'd
>> switch val [a b [print 'xx] c [print 'yy] d]
== none
>> switch/default val [a b [print 'xx] c [print 'yy] d] [print 'zz]
zz
>> val: 'e
>> switch val [a b [print 'xx] c [print 'yy] d]
== none
>> switch/default val [a b [print 'xx] c [print 'yy] d] [print 'zz]
zz
Important Notes
  1. We must carefully consider the 'd and 'e cases above. For example, it might be better if SWITCH returned TRUE when the case is found, but no block was provided. Also, are we sure we want to evaluate the default case when the case was found, but no block was provided?
  2. Note that the case value itself cannot be a block, nor can the case evaluation block be a variable. This could be a compatibility problem, and if it is, we may need to modify our spec or revert back to the old definition.

RAMBO

These changes were made:

 #4148, #4147, #4139:fixed the bugs in the IMAP protocol handler; added support for servers with a hierarchy delimiter different from "/": added port/locals/hierarchy-delimiter (none until the server is queried for the hierarchy delimiter - any LIST query that produces results will set it), no longer assumes "*" as mailbox name when doing a LIST and no name is provided (this allows doing a LIST "" "" query, that results in the hierarchy delimiter in port/locals/hierarchy-delimiter), LIST will now return a block of strings instead of a block of files (file! would be confusing if the hierarchy delimiter is not "/"). (not tested) (may break old code)
 #3861:center-face now defaults to centering relative to the face's parent face, and the help strings are made clearer.
 #3477:TAB and shift-TAB reveals hidden field: fixed.
 #4172:decimal type not set in grow-facets VID func: fixed the typo.
 #4143:new SWITCH function, also added /ALL refinement; rest of mezz code has been updated to take advantage of it. (may break old code)
 #3868, #4108:implemented better ESMTP support. (not tested)

Thanks

Thank you Gabriele Santilli for writing/collecting and supervising the above changes.

56 Comments

Updated 11-Sep-2009   -   Copyright 2006 Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code