Comments on: On JSON and REBOL
Flipping through some Github blog pages, I came across the Github API in JSON. For example: https://status.github.com/api
It's ironic. Every time I run across JSON examples, I see REBOL without the elegance. The two languages are related of course. REBOL strongly influenced the design of JSON.
Consider the above github API example...
"body": "Battlestation fully operational",
"body": "Almost done reticulating splines",
body: "Battlestation fully operational"
body: "Almost done reticulating splines"
It's clear, isn't it?
Expression of information is not just about structure. It's not just about name-value pairs. It's also about the datatypes as values and the ability to handle and manipulate those too.
Meaning isn't just in strings, it's in the full expression itself. A holistic representation. The REBOL form includes set-words, words, strings, dates, and blocks - lexically cleaner, less syntax, as well.
Unfortunately, many programmers don't think outside of the box. They're stuck in a narrow world of strings and unnecessary punctuation.
The mind is naturally capable and comfortable with so much more. Use it.
I wonder if it's possible that you might be so far above others in your understanding of such issues that others are thinking something like, "What in the world is he talking about" while you are thinking "How in the world can you not get this?" I am more on the not-getting it side, although I do think I see the point regarding the created-on item. If the alleged date is represented as just a sting, a program has to examine it to figure out what it is. In REBOL, you just "know" what it is, it's right there, "obviously" a date.
I wonder if your mission in the new R3 open source world should move toward hammering on all of us with theory and examples to help us get out of our boxes. That could help the wider world of programming, not just REBOL. You could be like Edsger Dijkstra and his "go-to considered harmful" article that launched structured programming.
I didn't write this. But it's profane and funny, and it features the word "FoRK" for some reason:
While I'm on a rant, F*CK JSON. I mean, first f*ck XML thoroughly and nastily, but let's call it like it is -wrt- JSON. Anything that forces me to do this sh*t:
...is BROKEN BY DESIGN!
NO MORE TUNNELING CRAP IN STRINGS!!!
*REAL WORLD*, modern datatypes, built-in, literal, batteries-included PLEASE!!! If the following aren't first-class types with first-class literal constructors / representations supported *at the language
level* then your new programming language ISN'T EVEN ON THE PLAYING FIELD
But let's be fair, here. Douglas came to you and he did try. He was really stoked about Rebol...still sings its praises to this day...but when we talked he said he just couldn't sell it as it was, and he wanted to participate with the world. You kind of tied his hands with the licensing model and he saw the writing on the wall. He hates the compromise as much as you, but he made it because he had no open source Rebol to bring to the table.
But that's all water under the bridge. Now we have it. Let's see where this goes...
In REBOL, you just "know" what it is, it's right there, "obviously" a date.
It's not just about how your code reads though, but an integral part about how you think about coding. This from the REBOL console...
>> r-day: 12-12-12/10:33
Now while there's no logical reason why an integer value should increase the date/time by a day (instead of a year or a minute etc. - deciding it'd be a day was just a practical choice), it is obvious that a time value should add hours and minutes to the date/time value.
>> r-day + 1
>> r-day + 1:15
>> for date r-day r-day + 3 1 [print date]
>> for date r-day r-day + 3 12:15 [print date]
Having dates and times and a large number of other useful datatypes available on tap in REBOL is one of the advantages of REBOL from the programmer's POV.
Steven, it's a good idea. In addition to above comments, I should write more about it and why it matters. Thanks for the suggestion.|
I totally agree with Carl, and I marked it in my post on:
I agree and have done for years, used to work with visual basic and it would make assumptions for you.
For example the contents of a textbox, a$ and b$
if you later coded a$ * b$ the sw assumed, oh, ok, well now they are numbers.
Then they changed it all with Vers 5 I think, then you wern't allowed to do that sort of thing anymore.
A high level language should take all of the drudgery out of programming, and make intelligent assumptions, If I ask my child to pass the salt, I dont expect him to tell me but dad, you havent specified what type of salt, are we talking salts of sodium, monohexaflouride, or salts of chromium, or vanadium, because if you are, we havent got any of those in.
If you want finickity syntax rules, thats a low level language which must be that way, but a high level language, working up here with us humans should be doing most of the drudgery for us.
But of course, thats exactly how programmers and software companies keep mere humans from muscling in on this billion dollar industry.
Heaven forbid that a mere shop owner should decide to cobble together a small database program to keep track of his stock for Free, then start passing copies of the code to other shop owners. Thanks for your amazing work to all at the Rebol Team.
Agreed, except that the industry myth you speak of extends to low-level languages. Even with a low-level language, you can get quite far in making it understand you. Red/System is achieving code that's amazingly close to REBOL and Red.|
I've always liked Rebol, especially the rich data types and rich constants and lack of unneeded punctuation.
|Brain Lesion - (how to c|
I'm watching a youtube video on json.
They can talk for an eternity about the punctuation and all the arcane notation, without ever discussing wtf they can actually do with the data, except maybe move it from A to B.
At that point they begin talking about more notation and conversion to make it acceptable as a new notation...
It just hurts, listening to this stuff.
They just called it "technology" again.
While we are on the subject of elegance...
I have these inane logs that parcel each value in matching double quotes, and then use a comma as a delimiter. Like this: "yada yada","bob is your uncle","yada2"
Unfortunately they also use a comma inside of values to separate subset elements in terms of date and time values.
What is the correct parse rule to turn every "," occurrences into a tab. That is double quote comma double quote, to a single Tab. I do not want to disturb single lone occurrences of commas. they have to be with quotes as in: "," to qualify.
|Rebol's a breeze..|
Prints each value enclosed in quotes, on a newline...
(They may not show as separate lines here)
foreach elem (read/lines %log.csv) [foreach value parse elem "," [print value: mold to-string value]
Yeilds this output:
"06 May, Mon, 09:30:52"
"XS4ALL Internet BV"
"24 Bit (16.7M)"
Bad Format: this definitely sounds like you are dealing to some sort of csv file?...
There are some Rebol scripts dealing with such files (not so insane, in my humble opinion; I use them very often for data transfer between databases (postgresql), spreadsheets, and they prove to be very reliable ;-)).
Just search in rebol.org, you'll find many scripts concerning .csv files.
This one, from Brian Hawley, seems quite recent:
Post a Comment:
You can post a comment here. Keep it on-topic.