Friday, March 27, 2015

I've been programming for the last five years, and I came across (definitely not learnt) a bunch a languages... So, in your opinion, which syntax (for blocks) it the best ? And why ? (b'cause without explanations, any advice is pointless...)
Here's the syntaxes I'm aware of :
do .... end

{curly braces}

    indentation (like Python)

Okay, first off there is no "best." The "style" of your block is a style and a preference. There is a quote about preferences that I can't find right now.

At the expense of readability, but for ease of creating a parser and lisp macros that generate lisp code, there is lisp and all of those wonderful parentheses which, of course, brings up the question of which brackets? )<{[()]}>(

Since you are going to indent anyways, the brackets become redundant. Of course, indentation brings up the question of tab vs. spaces?

"do ... end" is stylish, almost a beautiful prose in some coders' eyes, because the block can even be a short one-liner. But, this brings up the question of which keywords to use? Which "language" to use? English? Indentation and brackets are more "international" like math.

So, another way is using various editors that parse the code for you and put the code into the style that you prefer which, of course, brings up the question of which editor to use? Beautiful how emacs, or your preferred editor, matches the parentheses for you, but maybe not. Why do I need a special editor just to read my own code?

Using an editor that "parses" the code for you, brings up yet another question: Why not create a language that parses away some or all of the redundant begin and end block punctuation and/or keywords? ie. if x < 3 print less than three else print greater than or equal to three

Ooh, that just brings up a quagmire of questions...

Saturday, February 21, 2015

Show Codes is on

HTML is the language of the web.

HyperText Markup Language and before it there was and still is SGML: Standard Generalized Markup Language.  "Standard Generalized" is the key.  One of the basic things we've been doing with text is formatting it, but having a standard and generalized way to do this sounds like a panacea, a picnic.  A program, a problem just waiting to get messed up.  Bold, italics, underline:  I can see the little icons above this textbox in blogger.  A bold B, an italicized I, and an underlined U that I am formatting with the Apple key and the corresponding letter:  command-B, command-I, and command-U, or control-B, control-I, and control-U on Linux and Windows.  So easy these formatting "commands" that we've taken for granted for decades.

At some point along the way, the w3c tried to standardize HTML with a version number.  And, then the standard changed with the next version number.  And, I noticed that the w3c site and some of the standard looked suspiciously like Microsoft Word.  And, there were and maybe still are some Microsoft people on the standards committee.  The standard evangelized that we should be using for bold and for italics.  Also, suspicious a
tag was added which seems very very very similar to section in the original version of Microsoft Word.  Other strange oddities were added, it seemed that you could save a word document as HTML, so a mangled metal obstructive atrocity of keywords were added to a melange of tags.  All the weirdness was in place to accommodate Microsoft Word.

Taking it even further, a new language was created to attempt to make all the weirdness easier to deal with:  Cascading StyleSheets.  With this and proper document headings done in yet another markup language called XML:  eXtended Markup Language, one  could now display little badges of various versions that your web site might be compliant with.  Drink that cool-aid.  Drink all of that Kool-Aid until you see everything in sugary rainbows and you don't mind plunking down thousands of dollars a year for someone else's idea of what API you should be using.  Rather than <b>b</b> for bold, use named attributes:  <spunky id="6B29FC40-CA47-1067-B31D-00DD010662DA" class="my strongly-formatted thingy">bold</spunky>, and in another file, maybe in a different place on the internet, have a css file that describes what "spunky : my strongly-formatted thingy" should format as, maybe flaming rounded outlined bordered 4-bit per channel color.  Wait a minute!

I just want to make the text bold.  I shouldn't have to look this up in the spec., craft a css document, get the correct document headers in place, check and badge it with a validator, and wrap everything in strange tags and attributes.  Let's cut to the chase:  it's basic HTML:  <b>bold</b>, <i>italics</i>, and <u>underline</u>.  Simple.