First of all, a lot of the comments here, imo, are not so great, for they miss the meat of the matter. It's easy to poopoo a language because it's different, or verbose. Hacker News hates XML, worships s-expressions, and has some mixed fondness for maps and json, so the anti-XML snark is expected, I suppose. But let's put that aside talk about why X# is actually distasteful. That might even be helpful to the developers and incite more than defensiveness on their part.
Disclaimer: I'm not an X# expert. I've just read the pages linked to from the sidebar on http://xsharp.org. This review may well be a failure of marketing more than anything else.
When I saw the title, I was expecting something a bit like lisp, but with about 10x as many characters. Granted, xml done right is not just sexprs, so I was curious about how attributes might be used to add additional expressive power. Maybe, I thought, you could do something as "pure" as lisp, albeit with a much uglier syntax. It probably wouldn't be my thing, but it might be neat nonetheless.
Oh, if only.
The problem with X# is that it uses enough XML to be ugly, and yet not enough to be pure. If you were to use it, you still need to be thinking in a very ruby-like block syntax with stuff like processing-instruction and append-child and for-each and so on. (Nested with blocks? Srsly??)
The XML feels out of place, tacked on. Rather than use a consistent expression language to define programming language fundamentals, it seems like a sloppy addition to a kludgey language.
The examples seem to use some powerful built-ins, without telling me how I would actually apply the concepts to new ideas. What is the xml "schema" for an HTTP POST? For a CouchDB document? For a curl request to the Twitter API, or the results of it?
In other languages, it's generally very clear how a given bit of XML is turned into an object. However, it's not so clear here how a given bit of JSON (or other data) would be turned into XML, or vice versa. Compared with the facilities in ruby or php for handling any kind of data encoding syntax, I wouldn't even consider this. How do I dump out the data? What are the rules for converting non-XML to something that's XPath-able?
Take this example, for instance (comments added)
<!-- start in curly-brace land, using builtin for-each and document functions,
passing xpath query on the imap "document", which is not natively XML -->
for-each document('imaps://imap.gmail.com?user=jkirk@gmail.com&pass=secret')/folder[@name='INBOX']/mail[@seen = 'false'] {
append-child document('smtp://smtp.gmail.com') {
<!-- switch to XML to define the message.
Where do I look up the XML syntax for a message? I would not
have guessed that this would be the way to do it. -->
<!-- Function call in the subject attribute? That's weird.
What if I wanted to email someone about curly braces and
concatenation functions? Would I have to escape the curly
braces that are escaping the function nested in my xml nested
in my code? I think the "fail" stack just overflowed. -->
<mail subject="{concat('RE: ', @subject)}" from="jkirk@gmail.com" to="{addresses/from/@address}">
<!-- So, we're back to c-ish syntax now? That is so strange.
Also, text must be quoted inside of XML? I always thought
the primary (only) benefit of XML over sexprs or JSON is that
plain text doesn't have to be quoted or escaped. -->
"Hi text ";
select addresses/from/@name;
",\n\nI've received your message titled '";
text @subject;
"' and\nI will reply to it shortly.\n\n--James\n";
</mail>
}
}
Letting data and code mingle closely is an attractive premise, to be sure. XML is not the only data definition language, and many would argue that it's far from the best, but it's certainly a contestable point. In my view, it is not XML that turns me off from X#, but rather the overall lack of consistency and transparency in the language.
Also, about the footer and some general site tips… The mascot has <?X#?> on his chest, but the language doesn't use <? as far as I can tell. (Or does it? Jesus, please say it doesn't.) This code is not poetry. (The tumbleweeds in the forums and on the blog also do not inspire confidence.)
It would be better to start with the most elegant syntax possible, and work backwards from there to an implementation. As it is, with the market for programming languages and frameworks so full of robust and elegant solutions, I would not even consider using X# for anything whatsoever.
- The syntax we have at xsharp.org is an alternative C-like syntax (which we are still working on BTW). The full XML way of coding X# can be seen at http://wiki.codeglide.com/X_Sharp/Examples.
- Rules to convert non-XML structures to XML are defined by the connectors. We've chosen an intuitive XML structure to represent non-XML data on these connectors. Of course you can't guess what is the structure an XML that represents an e-mail has to have, but this is the same in other programming languages, you need documentation or an IDE with inline help to find out how to do stuff. The most powerful feature of X# is that you can combine data from unlimited and different sources using XPath and that instead of using multiple functions all actions are abstracted behind common operations such as append, remove, select and update.
- Yes, <?xpath ?> is used on the XML syntax to select nodes.
Originally X# was going to be a language to create applications visually and we chose an XML syntax because each tag is represented by a visual element on screen. Since we are still working on the visual X# editor, we offer an alternate C-like syntax (which is not definitive).
Although X# is Turing complete, we are not proposing it as a general purpose programming language -- we know it has limitations, having this level of abstraction has trade offs. Of course if we need to write a 3D Adventure Game or a Web Server we will use another language, but for writing the web based applications we wrote it has proven to be extremely fast and useful.
Disclaimer: I'm not an X# expert. I've just read the pages linked to from the sidebar on http://xsharp.org. This review may well be a failure of marketing more than anything else.
When I saw the title, I was expecting something a bit like lisp, but with about 10x as many characters. Granted, xml done right is not just sexprs, so I was curious about how attributes might be used to add additional expressive power. Maybe, I thought, you could do something as "pure" as lisp, albeit with a much uglier syntax. It probably wouldn't be my thing, but it might be neat nonetheless.
Oh, if only.
The problem with X# is that it uses enough XML to be ugly, and yet not enough to be pure. If you were to use it, you still need to be thinking in a very ruby-like block syntax with stuff like processing-instruction and append-child and for-each and so on. (Nested with blocks? Srsly??)
The XML feels out of place, tacked on. Rather than use a consistent expression language to define programming language fundamentals, it seems like a sloppy addition to a kludgey language.
The examples seem to use some powerful built-ins, without telling me how I would actually apply the concepts to new ideas. What is the xml "schema" for an HTTP POST? For a CouchDB document? For a curl request to the Twitter API, or the results of it?
In other languages, it's generally very clear how a given bit of XML is turned into an object. However, it's not so clear here how a given bit of JSON (or other data) would be turned into XML, or vice versa. Compared with the facilities in ruby or php for handling any kind of data encoding syntax, I wouldn't even consider this. How do I dump out the data? What are the rules for converting non-XML to something that's XPath-able?
Take this example, for instance (comments added)
Letting data and code mingle closely is an attractive premise, to be sure. XML is not the only data definition language, and many would argue that it's far from the best, but it's certainly a contestable point. In my view, it is not XML that turns me off from X#, but rather the overall lack of consistency and transparency in the language.Also, about the footer and some general site tips… The mascot has <?X#?> on his chest, but the language doesn't use <? as far as I can tell. (Or does it? Jesus, please say it doesn't.) This code is not poetry. (The tumbleweeds in the forums and on the blog also do not inspire confidence.)
It would be better to start with the most elegant syntax possible, and work backwards from there to an implementation. As it is, with the market for programming languages and frameworks so full of robust and elegant solutions, I would not even consider using X# for anything whatsoever.