Re: Developer story: Foreign data types (example with HTML)
"Aryeh M. Friedman" <[email protected]> Sun, 10 Aug 2003 23:00:02 -0400 (EDT)
| Newsgroups | gmane.comp.programming.pragmatic |
|---|---|
| Message-ID | <[email protected]> |
If anything seems to question the below I am just attempting to get clarification.
> ** The Problem --------------------------------------------------------
>
> Many languages allow to create new data types (classes, typedefs, etc)
> but they don't allow new semantics with them.
This is the whole goal of the PCL macro system. I need to just see if
we are talking about the same thing.
> For example, I can't say:
>
> HTML div = <Div class="demo">
> <b>
> This is some text.
> </b>
> </Div>;
So far I see no issue except for maybe interoperability with some non-OO paradigm but
I don't think this is an issue since the above is nothing but a meta-paradigm.
> or even improve on that syntax:
>
> HTML div = Div (
> class="demo",
> Bold ('Some text'),
> )
Either way should work just fine.
> ** Proposed Solution --------------------------------------------------
>
> Pragmatic should allow to extend the compiler with new data types
> and new syntax with new semantics. In the end, I should be able to
> say things like this:
>
> HTMLFragment a = HTML (url="http://some.doma.in/path/to/document.html")//Div[@class == "demo"]
I am sure we can make this even nicer syntatically in the long run. My first
real app for Pragmatic is a blackboard (smart clipboard) GIS application that needs to target
the web as well as other front end viewers so there will be a rich HTML meta-paradigm in Pragmatic.
> The syntax extension should allow to change sematics without
> any additional keywords. For example, when I have an XML file
> which contain information about items in stock:
>
> <root>
> <item>
> <name>CD-RW</name>
> <count>5</count>
> <item>
> </root>
Weither or not a meta/first class paradigm pushs this beyond the PCL level is
upto it... I personally think one of the requirements for a first class paradigm to be
accepted as such will be to impliment paradigm extension without having to drop all the
way to PCL macros.
> Then I want to be able to modify the count with this code:
>
> XML document = XML (url="stock.xml")
>
> // Does the item exist?
> XMLFragment select = document//item/name/[text() == 'CD-RW'];
> if select:
> // Find the count element of the selection,
> // convert it to int and decrement it
> select/../count -= 1
>
>
> // Rename "stock.xml" to "stock.xml.bak"
> // and save the document as "stock.xml".
> document.saveWithBackup ()
If the XML meta-paradigm is implimented with first class paradigm standards intack
this should be trivial.
--Aryeh
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Low on Ink? Get 80% off inkjet cartridges & Free Shipping at 77Colors.com.
We have your brand: HP, Epson, Lexmark, Canon, Compaq and more!
http://www.c1tracking.com/l.asp?cid=5981
http://us.click.yahoo.com/DmnqpB/IyhGAA/ySSFAA/W4wwlB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
pragmatic_lang-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/