[
Lists Home |
Date Index |
Thread Index
]
- To: "Xml-Dev (E-mail)" <xml-dev@lists.xml.org>
- Subject: RE: [xml-dev] XUL Compact Syntax Study Now Online - Is XML too hardfor Aunt Trudie?
- From: "Kirkham, Pete (UK)" <pete.kirkham@baesystems.com>
- Date: Fri, 16 Apr 2004 10:47:54 +0100
- Cc: Gerald Bauer <luxorxul@yahoo.ca>
- Thread-index: AcQjjGkQRgvy+n0gSiuEpm6PMkSx9gABGohw
- Thread-topic: [xml-dev] XUL Compact Syntax Study Now Online - Is XML too hardfor Aunt Trudie?
Does the 'C' form have any relation to the 'C' programming language, other than use of braces?
If not, then replace it with either UML 2 HUTN or ASN.1 value notation. The direct mapping of the schema for XUL to ASN.1 would give you something very similar; the UML 2 HUTN could (potentially) give you CASE tool interop. There doesn't seem to be any need to invent yet another curly brace language when there exist ones that cover your use cases.
Would the 'lisp' form support macros? You can get some way towards having the code look like the gui if you do (see example below). It also would seem more natural to use keyword symbols rather than @foo for the lisp form.
Am I right in thinking that the labels for your widgets are just close to rather than associated with the widgets they label?
Pete
--
;; example use of macros to build gui
;; some reusable macros
(defmacro cbxen (&rest labels) `(hbox ,(mapcar (lambda (label) `(checkbox :label ,label)) labels)))
(defmacro gbx (id caption &rest contents) `(groupbox ,id (caption :label ,caption) ,@(macroexpand contents)))
(defmacro horizontally (&rest widgets) `(hbox ,@(macroexpand `(buildwidgets ,@widgets))))
(defmacro vertically (&rest widgets) `(vbox ,@(macroexpand `(buildwidgets ,@widgets))))
(defmacro buildwidgets (&rest widgets)
(mapcar (lambda (widget)
(cond ((stringp widget) `(label :value ,widget))
(T (macroexpand widget))))
widgets))
;; this expands to the example gui (modulo a nested hbox)
(macroexpand
'(gbx bedView
"Ordering Your New Bed"
(horizontally "Name:" (textbox name ) "Address:" (textbox address :cols 30 ))
(horizontally "City:" (textbox city ) "State:" (textbox state :cols 2 )
"Zipcode:" (textbox zip :cols 5 ) "Customer Code:" (password code :cols 8 ))
(horizontally "Type of wood:" (choice woodtype :list woodtype) "Size:" (choice size :list size :type radio ))
(horizontally "Extras:" (cbxen "Footband" "Drawers (for underneath)" "Casters" "Squeak proofing" ))
(vertically
"Please share any suggestions or comments with us:"
(textarea comments :rows 3 :cols 65 ))
(horizontally (button submit :label "Order Bed" ) (button reset :label "Start Over" ))))
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
|