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

[REBOL] Re: XML examples?

From: jasonic:panix at: 22-Sep-2001 3:25

> you could have a look at http://www.h-o-h.org/the_sea.r > A simple addressbook, saving data as xml. > > kind regards, > > Ingo
Thanks Ingo & everyone :-) I just came across these tonight: http://www.obscure.dk/rebol/ a. XML-Utils Extended XML utilities, currently contains an XML parsing function b. XML-RPC XML-RPC client and server functions, requires xml-utils.r c. ReMuSeS General purpose TCP/IP server framework. Inspired by the Python Medusa project. All are dated 24-Sep-2000. I am new here, but so apologise this is tired news for you. OT => some prgoramming background ... with basic Rebol questions: Part of what brings me to Rebol is my hopes for and frustrations for trying to design peer-peer smart-clients applications in Zope, [which is based on Medusa.. interesting!] Zope has a formidable learning curve and intense mailing list activity to go with it. Zope's object publishign paradigm means that one can call any object [object, data or method] via URL which looks just like REBOL's path syntax, for similar reasons. I like Python very much and find it plays nicely with REBOL. Python is a little more verbose left to right, but Rebol is more verbose top to bottom. This is becuase Python uses white space indentation to remove big nested brackets. A major plus is that code is readable and consistently so. Rebol's blocks ][][]] still look rather messy to me, but I had no Lisp experience. [scared by all those ((((())))) fx :-)] After reading Rebol for the past few days, I find my oh-so-minimal Python now has ['way' ,'too' ,'many' , 'commas, and "quotes" if, you, "know what I mean"] To my newbie Rebol wide-eyes, I notice that the cleanest reading ReBol code is a little like great Forth. [that's a compliment btw]. When names are _well_ chosen and the left-right syntax reads smoothly, it show the problem has been well understood and factored. Easy to say but not so easy to do.. I had recently been looking at various techniques and cool 3rd party modules in Python for XML-to-object adn vice versa. So am delighted to see the response to this thread is in the same spirit of less-is-more, appropriate design. The two main things I miss from Python: - dictionaries [associative hash arrays] - named arguments Python Dictionaries look like this:
>>> rolodex = {'name' : 'Jason', 'email' : ['jasonic--nomadics--org']} >>> print rolodex.name
'Jason'
>>> rolodex['name']
'Jason' It seems the way to do this in REBOL is
>> rolodex: [name jason email [jasonic--nomadics--org]] >> rolodex/name
== jason etc RQ1: With much bigger block, how do you keep track in these implicit pairs of what is a 'key' and what is a 'value'. In Python the extra punctuation is more verbose, but always unambiguous Named arguments for Python functions and classes allow one to set default values very nicely. you can also call arguments in any order. The result is terrific readibility, because you don't have ask what argument is what, or deal with a predefined order. If you follow the pre-defined order, then you can drop the 'name=' part instead provide just the value. Python expressions can take these forms: expression function([value, name=value,...]) object.method([value, name=value,...]) To make a new function: def name([arg, arg=value, *arg, **arg]): suite arg simple name arg=value default if arg not passed *arg collects extra positional args **arg collects extra keyword args RQ2: Can anyone translate this into REBOL or suggest strategy for attaining a keyword clarity. Perhaps it is not even desirable/necessary.. And please don't misunderstand. I am not trying to tilt at windmills, or start any language-flame wars, just trying to understand How Rebol works and take inspiration from good ideas wherever interesting people gather. thanks - Jason