xml in Ruby or no xml it's just a question

xml in Ruby or no xml it's just a question

Post by paul vudma » Sat, 04 Oct 2003 01:46:38


>>--------
"Chad Fowler" < XXXX@XXXXX.COM >
Pretty much everything you've mentioned here is
possible with REXML
--------------------<<
Except the style. Besides, that was part of my point.

"Chad Fowler" < XXXX@XXXXX.COM >
I can't see how hard-wiring XML as a part of Ruby's
syntax
provides much of a benefit at all. It would be
fashionable (though not
really all that fashionable these days), but barring
that it's just
more
baggage to carry around.
---------<<
It's interesting to me that you would wrap an xml
file(rss) in an object
http://www.yqcomputer.com/
but belittle an offhanded attempt to make inherent
those attributes that you so painstakingly crafted
code for and call the former more baggage. Help me
understand that, Chad!


"Chad Fowler" < XXXX@XXXXX.COM >

Interesting in the same way that Lojban is interesting

( http://www.yqcomputer.com/ ). :)
--------------------<<
for you!


"Chad Fowler" < XXXX@XXXXX.COM >

Are we playing sports or writing programming
languages? I didn't know
it
was a competition. Who are the enemies? Is anyone on
our team?
--------------------<<

I'm just a simple scriptor making an open ended
suggestion about a language that i enjoy in a forum
that i would hope would encourage such things - even
if they are stupid. What language are you writing,
btw? Just an analogy, maybe a bad one. Sorry.

"Chad Fowler" < XXXX@XXXXX.COM >
more readable?

..<list><item>blah</item><item>blah2</item><item>lkjsdf</item></list>

vs.
["blah", "blah2", "lkjsdf"]
--------------------<<

More readable as in 'more context' not as in more
succinct or fewer letters or anything else.(ie are
those an array of items in a list or just a lot of
blah?)


With REXML in the distribution you can already do
this. Just requires a few more keystrokes.
-----<
Sure but fewer works for me better.

"Chad Fowler" < XXXX@XXXXX.COM >
Where
would you rather have coupling?
-----------<<
Where it serves me best. I was merely contemplating
another tool to choose from. I'm not unaware of the
implications.

"Chad Fowler" < XXXX@XXXXX.COM >
No offense intended, but I hope not :)
-----------<<

None taken!

"Erik Terpstra" < XXXX@XXXXX.COM >
Last year I made a quick hack that could do something
like that.
I didn't have much experience with Ruby back then, so
it is a quick and
very dirty solution. But the following works:
---------->

Thanks Erik i'm going to take a look at this and see
if i can use it! I'm still a newbie and will prob
learn a lot from it in any case.

:P



__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://www.yqcomputer.com/
 
 
 

xml in Ruby or no xml it's just a question

Post by Zach Denni » Sat, 04 Oct 2003 02:03:06

I think it would be wonderful if Ruby could handle XML somewhat how Flash
Actionscript handles XML( but with a few tweaks here and there of course ),
but the overall way that the Actionscript XML Object is a beautiful thing.
Or at least I think. I think it would be a plus.

-Zach

 
 
 

xml in Ruby or no xml it's just a question

Post by Chad Fowle » Sat, 04 Oct 2003 02:09:26


# >>--------
# "Chad Fowler" < XXXX@XXXXX.COM >
# Pretty much everything you've mentioned here is
# possible with REXML
# --------------------<<
# Except the style. Besides, that was part of my point.
#

Well, when you say "style" I think you mainly mean syntax, right? Other
than XML being first-class syntax, the rest of the style you've proposed
is do-able (and reflected quite well in Erik's posted code).

# >>--------
# "Chad Fowler" < XXXX@XXXXX.COM >
# I can't see how hard-wiring XML as a part of Ruby's
# syntax
# provides much of a benefit at all. It would be
# fashionable (though not
# really all that fashionable these days), but barring
# that it's just
# more
# baggage to carry around.
# ---------<<
# It's interesting to me that you would wrap an xml
# file(rss) in an object
# http://www.yqcomputer.com/
# but belittle an offhanded attempt to make inherent
# those attributes that you so painstakingly crafted
# code for and call the former more baggage. Help me
# understand that, Chad!
#

First of all, you could hardly call the process of creating that simple
library painstaking. The fact that I wrapped RSS parsing in an object
demonstrates (though rather poorly considering the age of this code--see
Austin Ziegler's replacement on SourceForge) my belief that things like this
should be abstracted into *libraries* and not the language. Someone else has
created a CSV library. We could include CSV as a native data type too.
How about URIs? We have uri.rb, but why shouldn't we be able to simply
say:

myURI = http://www.yqcomputer.com/

How about JPEG files? With the right graphical programming environment,
you could actually embed pictures into code. myVar = <drag a png file
into the editor>. myPic.vertical_flip.

#
# >>--------
# "Chad Fowler" < XXXX@XXXXX.COM >
#
# Interesting in the same way that Lojban is interesting
#
# ( http://www.yqcomputer.com/ ). :)
# --------------------<<
# for you!
#

Don't you find Lojban interesting?

#
# >>--------
# "Chad Fowler" < XXXX@XXXXX.COM >
#
# Are we playing sports or writing programming
# languages? I didn't know
# it
# was a competition. Who are the enemies? Is anyone on
# our team?
# --------------------<<
#
# I'm just a simple scriptor making an open ended
# suggestion about a language that i enjoy in a forum
# that i would hope would encourage such things - even
# if they are stupid. What language are you writing,
# btw? Just an analogy, maybe a bad one. Sorry.
#

"We" as in the community, of course. And the language would be ruby. I
certainly wasn't implying that I'm personally creating Ruby, but that's
pretty obvious. I was serious about the question I asked, though. Why
the competition?


#
#
# >>--------
# "Erik Terpstra" < XXXX@XXXXX.COM >
# Last year I made a quick hack that could do something
# like that.
# I didn't have much experience with Ruby back then, so
# it is a quick and
# very dirty solution. But the following works:
# ---------->
#

Erik demonstrated the same point I was trying to make, but he had some
working code :)
 
 
 

xml in Ruby or no xml it's just a question

Post by Chad Fowle » Sat, 04 Oct 2003 02:10:17


# I think it would be wonderful if Ruby could handle XML somewhat how Flash
# Actionscript handles XML( but with a few tweaks here and there of course ),
# but the overall way that the Actionscript XML Object is a beautiful thing.
# Or at least I think. I think it would be a plus.
#

Zach, do you have a link or an example? I've heard good things about
ActionScript's XML handling myself.

Chad
 
 
 

xml in Ruby or no xml it's just a question

Post by dblac » Sat, 04 Oct 2003 02:11:38

Hi --





That's how it works: there's a core language, and then there are
libraries and programs. You can't put everything in the core
language.


It's just a lot of blah -- well, an array of strings, to be a little
more specific. They may or may not serve as "items" in a "list" at
some point, inside some kind of object and/or markup system. That's a
separate matter.


David

--
David Alan Black
home: XXXX@XXXXX.COM
work: XXXX@XXXXX.COM
Web: http://www.yqcomputer.com/ ~blackdav
 
 
 

xml in Ruby or no xml it's just a question

Post by paul vudma » Sat, 04 Oct 2003 02:13:24

No, when i say 'style' i mean...what i want my 'data'
to look like.

:pv

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://www.yqcomputer.com/
 
 
 

xml in Ruby or no xml it's just a question

Post by paul vudma » Sat, 04 Oct 2003 02:36:41

>>----------
David Wrote:
That's how it works: there's a core language, and then
there are
libraries and programs.
------------<<
.. and core languages have types - of variable
complexity each suited for one purpose or another. I'm
suggesting xml would a mighty fine type - the logical
evolution of data -data about data. You can then
create your own types.

David Wrote:
You can't put everything in the core
language.
-------------<<
Nope. And this mike make ruby fat, your right. Not
necessary part of the core(tho i would argue that it
should) but if required, if it were a native type, and
accessible like erik noted, i'd be real happy.

Tho i'm real happy using rexml now, anyway ;)

don't make me go off unhappy and create my own damn
language either. I've got a name in mind already.
*** y ;->


i could be wrong, :pv

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://www.yqcomputer.com/
 
 
 

xml in Ruby or no xml it's just a question

Post by Austin Zie » Sat, 04 Oct 2003 03:09:46


"Chad Fowler" < XXXX@XXXXX.COM >

I'm not Chad, but as someone who liked what Chad did and wrote a
follow-up library that (mostly) conformed to his API, I can explain
exactly why I did it much the same way. Basically, Chad is
representing an object (a rich site summary, or a channel). That it
happens to correspond to an XML format is somewhat irrelevant. There
are actually four common variants on this, and two less common
variants. By designing channels as objects, it becomes relatively
easy to support those variant formats.


There is no meaningful distinction between an array and a list in
Ruby. In all likelihood, you might do:

class List
def initialize(*items)
@items = *items
end
attr_reader :items
end

list = List.new(%w{blah blah2 ljksdf})
list.items # => ["blah", "blah2", "lkjsdf"]

When you're writing a program, why would you want to add unnecessary
semantic information (e.g., encode the list as XML) when the
necessary semantic information is already present. The only time you
need to worry about such semantic information is when you write it
to an external format ... like XML.


Yeah, but you've traded fewer keystrokes here in favour of more
keystrokes elsewhere.

You may want to look around the archives for a discussion of %y{}
(for YAML) and the like that happened around the 10th of September.
Basically, some of the same suggestions you've made came up -- and
weren't really liked.

-austin
austin ziegler * XXXX@XXXXX.COM * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.10.02
* 13.58.40
 
 
 

xml in Ruby or no xml it's just a question

Post by Austin Zie » Sat, 04 Oct 2003 03:17:34


Erm. Yes. And Ruby does have a single core type: an object. Sure,
there's some language syntax to help around other common types
defined in the C portion of the Ruby library (numerics, strings,
arrays, hashes), but I think you're buying into the marketing hype
about XML. Ruby *already provides* data about data. If you create
your object hierarchy for your programs correctly.

XML is best suited as a transmission data type (except its
verbosity, but that's neither here nor there). It allows for
meaningful data serialization across languages. It is not well
suited as a "native" data type -- because it's unnecessarily
verbose and doesn't really provide meaningful information to the
program. If I have:

<address>
<first></first>
<last></last>
...
</address>

I am most likely to represent that as an object in my program:

class Address
attr_accessor :first
attr_accessor :last
end

I think you're mixing up what is properly a separation of concerns
here.

-austin
austin ziegler * XXXX@XXXXX.COM * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.10.02
* 14.12.17
 
 
 

xml in Ruby or no xml it's just a question

Post by paul vudma » Sat, 04 Oct 2003 04:07:35


No, we've just got a difference of opinion. Your
tieing up your data writing an interface for it. There
may be good reasons to do so. Then there may not.


Sorry, but i gotta tell you i bot into this xml thing
a long time ago. I was skeptical at first but i now
find myself with more and interesting ways to use xml
to PROGRAM. I hardly ever send it over the wire.

Whether or not is would make Ruby unnecessarily slow
or inefficient, i really could not say, probably so,
i'd guess. Make my programs better? Absolutely.

Again, i can do that with rexml now. Just kicking
around an idea.

pv




__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://www.yqcomputer.com/
 
 
 

xml in Ruby or no xml it's just a question

Post by paul vudma » Sat, 04 Oct 2003 04:12:20


<<

Chad, Austin, my apologies, maybe it's not a good
idea.

:P

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://www.yqcomputer.com/
 
 
 

xml in Ruby or no xml it's just a question

Post by Zach Denni » Sat, 04 Oct 2003 04:39:54

You can check out this link:

http://www.yqcomputer.com/

Some of the XML stuff is custom XML written in Actionscript(AS) by Branden
Hall and Colin Moock because Flash's builtin XML parser was slow on large
files. I dont know if anyone else out there knows this works, but I would be
interested in experimenting with writing an XML Object in Ruby that worked
in a similiar way to Flash if no one else is working on it. I would write it
in Ruby of course and prefer someone else to write it in C.

I dont want to step on any toes, but I'm always up for a weekend of straight
programming. =)

-Zach

-----Original Message-----
From: Chad Fowler [mailto: XXXX@XXXXX.COM ]
Sent: Thursday, October 02, 2003 1:10 PM
To: ruby-talk ML
Subject: Re: xml in Ruby or no xml it's just a question




# I think it would be wonderful if Ruby could handle XML somewhat how Flash
# Actionscript handles XML( but with a few tweaks here and there of
course ),
# but the overall way that the Actionscript XML Object is a beautiful thing.
# Or at least I think. I think it would be a plus.
#

Zach, do you have a link or an example? I've heard good things about
ActionScript's XML handling myself.

Chad
 
 
 

xml in Ruby or no xml it's just a question

Post by paul vudma » Sat, 04 Oct 2003 05:17:56


http://www.yqcomputer.com/


Did you see erikss code ?

http://www.yqcomputer.com/

There's some sorta perl module in there, me thinks, so
be careful :)

pv

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://www.yqcomputer.com/
 
 
 

xml in Ruby or no xml it's just a question

Post by Zach Denni » Sat, 04 Oct 2003 05:23:01

Oh my bad, must have missed that one. I thought he was saying he would have
liked something like that. =)

-Zach

-----Original Message-----
From: paul vudmaska [mailto: XXXX@XXXXX.COM ]
Sent: Thursday, October 02, 2003 4:18 PM
To: ruby-talk ML
Subject: Re: xml in Ruby or no xml it's just a question




http://www.yqcomputer.com/


Did you see erikss code ?

http://www.yqcomputer.com/

There's some sorta perl module in there, me thinks, so
be careful :)

pv

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://www.yqcomputer.com/
 
 
 

xml in Ruby or no xml it's just a question

Post by James Brit » Sat, 04 Oct 2003 06:20:00


And this extends perhaps more so to such things as RDF and (XML) Topic
Maps. They both make extensive use of XML, but as a serialization
format. The markup is not the model, just a handy way of expressing it.

Once I've slurped in some XML I'm more interested in what role it's
meant to play in a given context than in the specifics of angle brackets
and nested text. Creating objects around the syntax allows the
developer to focus more on the information set than on the serialization.

Now, I can see the value in having an XML-centric syntax available when
the XML-ness of something is the primary concern. This would be a great
benefit to XML folks who (for whatever reasons) choose Ruby for their
XML manipulation. They might rather focus on an XML view of the world,
rather than adopt Ruby idioms, for DOM or text manipulation.

Some of these ideas have been disccussed on the RubyGarden wiki:
http://www.yqcomputer.com/

I also proffered the idea of E4X-like syntax in Ruby, on the REXML
mailing list ( XXXX@XXXXX.COM ). There was a bit of
discussion, though overall it was not well recieved :).

By and large, it seems relatively easy to add such behavior when and
where you need it through the use of modules. I'm unconvinced there is
such a compelling need for this syntax in the core language.

(But such discussions may find there way into my presentation on the
state of XML processing in Ruby at RubyConf 2003. Be there or be square.)

James Britt
jbritt AT rubyxml DOT com