
Programming Languages as Boy Scouts - wcrichton
http://notes.willcrichton.net/programming-languages-as-boy-scouts/
======
cmontella
Sorry to self-promote a little but, but I just published a dev diary [1] for
Eve, where I talk about a lot of the same ideals described here. For instance,
the author writes:

> For brownie points, your compiler should explain why the programmer has
> encountered an error, and for the gold medal it should propose a solution.

This is exactly what we're trying to do with Eve. In one of the examples [2],
I show an error that is met with a full explanation of what went wrong, a
possible fix, and even a button that offers to fix the error.

On our philosophy toward errors, we've identified that they should be
understandable (written in full plain English sentences), relevant (point to
the root cause of the error, rather than incidental errors), and actionable
(we provide the reason for the error, offer to automatically fix the error
where possible, and teach the user why the error occurred and how to avoid it
in the future.)

We're still in the early stages of handling errors, but this is at least how
we're thinking about it.

[1]
[http://incidentalcomplexity.com/2016/08/03/july/](http://incidentalcomplexity.com/2016/08/03/july/)

[2]
[http://incidentalcomplexity.com/images/errorExample.gif](http://incidentalcomplexity.com/images/errorExample.gif)

~~~
cpeterso
One advantage of non-human-readable error messages is that they are easier to
Google. Microsoft's compiler warning and error messages all have unique error
codes like C1234, which make them easier to find on sites like MSDN or Stack
Overflow.

[https://msdn.microsoft.com/en-
us/library/aa249862(v=vs.60).a...](https://msdn.microsoft.com/en-
us/library/aa249862\(v=vs.60\).aspx)

~~~
Klathmon
Well the 2 aren't mutually exclusive.

Throw a unique error code in there, as well as a description on how to fix it.

~~~
Jtsummers
ERROR 832A: Line 42, missing semicolon, you probably won't a semicolon here:

    
    
      foo();
           ^
    

Or something of the like. If the compiler knows the error, it knows what
things might be missing. In the case of limited options it could predict and
continue parsing. Then, with a more complex error, that error code is actually
useful for googling or reviewing the compiler documentation.

~~~
seanmcdirmid
Or one could just apply semicolon inference and emit a warning, allowing the
code to still run, at least.

~~~
taeric
That would probably be a step backwards. I'm all for a debug mode that can let
bad code in a running environment. It should not pass a build, though.

~~~
seanmcdirmid
Depends if you are compiling/executing the code continuously or not during
development. Old-style batch programming environments are already plenty of
steps backwards.

~~~
taeric
Fair. I actually loved the feature of Eclipse where bad code would pseudo
compile. I just worry heavily about anything that emits warnings. Most
warnings, it seems, either should have been failures, or needed more powerful
tooling to know why it was ok.

~~~
Retra
Warnings are basically errors that don't halt compilation. You shouldn't have
any of either in production code.

~~~
taeric
My point, exactly. I don't want more things that don't halt compilation.

If you have a special environment that can fake it, fine. But the general
build run of compilation should fail much faster than it typically does.

------
labrador
I sat down to learn Python a few years back to add another language to my tool
belt. I ended up hating it in the first 10 minutes and haven't really had the
need to use it since. Why? My sample program looked perfect. It was indented
properly without braces - losing braces was the first concession the language
asked me to make - but it wouldn't run because of one line which was indented
several places. Three of those indents were 4 spaces each, but one of them was
a tab. The interpreter chose not to tell me this fact. It merely said my
program had illegal indentation or something. Looking at it I didn't see any
problem. Solving this mystery was an unnecessary waste of 10 minutes of my
life and I decided on the spot that Python was too opinionated for my tastes
and not helpful at all. Then I read the designers of Python are forcing coders
to change their "print" statement when upgrading Python 2 to Python 3 and
think my first impression was right.

In terms of Boy Scouts, Python is the kid with strict dietary requirements who
insists the other boys eat his crappy food, just because.

~~~
jomamaxx
Admittedly, that part stinks. It's been 20 years and they still haven't fixed
some of those basic things.

BUT - Python is a great language for scripting. If you need to parse some
stuff, produce a result ... Python is it.

The documentation bytes, I'm not a big fan of how it scales, packages are
clumsy, deployment can be clumsy, but if you can get past those things, script
away.

As far as brackets: in the long run I think it's better. I was very resistant
to it at first. But then I came to prefer it.

I actually wish Java had a bracket-less option.

If Java had that, plus simpler file access, plus amazing array and string
access ... man, that would be great.

Even though those are 'small things' \- in reality, a lot of scripting code is
filled with that, so it really adds up.

Going one step further ... maybe heretic - but having worked with a lot of
Javascript ... I suggest that some loose data typing options would be great as
well.

JSON in Java is a goddam pain. JSON and Javascript is seamless.

A lot of front-end programming is very data centric, but in the 'micro sense'
i.e. passing around a lot of little bits of data. Also, it's highly event
drive and async, which JS does well. So - also add more seamless async (Java
Lambdas approach this) - and voila, Java could be better for UX type things as
well.

But languages don't evolve very well, sadly :) it usually takes someone to
come along and reinvent it using best practices and maybe a big company to
support it, and it takes years to get to maturity.

Either that or to create a highly 'proprietary' version of something, a-la
Microsoft.

~~~
douche
Almost, but not quite would be [http://www.groovy-
lang.org/](http://www.groovy-lang.org/)

~~~
vorg
> I actually wish Java had a bracket-less option

Jython is much older and more stable than Apache Groovy, and is bracket-less
so there's no "almost but not quite" about it. It only exists for Python 2.x,
not Python 3, which is a result of its stability.

------
patorjk
It should be noted that Scout Law varies depending on what country you're in.
For example, some countries have laws saying a scout should smile and whistle
under all circumstances. I'm not sure how one would work that into a positive
property of a programming language.

~~~
33W
What is R2D2 written in?

~~~
jacobr1
ada

------
basseq
Who's going to take this a step further, evaluate every programming language
against this framework, and tell us who's the Eagle Scout of the group?

~~~
kvark
If you read between the lines, the author has already chosen the Eagle Scout
;) Although, I'd much appreciate the analysis of "every programming language"
too!

------
mshenfield
Elm wins the gold medal for helpfulness. [http://elm-lang.org/blog/compiler-
errors-for-humans](http://elm-lang.org/blog/compiler-errors-for-humans)

------
jomamaxx
Ha. I think Java is the best all round language. Oddly, it's usually not the
best language for any specific thing :).

Paradox :)

~~~
qwertyuiop924
I think Lisp is the best all-rounder. If it isn't the best at something, you
can MAKE it the best.

~~~
jomamaxx
Lisp as a 'language' maybe, but the problem is it's more than syntax and
compiler. The advantage of JVM, garbage collection, relative platform
neutrality, docs that are really consistent, libraries that are very easily
shared, and the huge amount of things built into the lang package over time,
the number of Q/A on Stack Overflow, resources available, support, 3rd part
libraries - these are things that Lisp really lacks, making it not a very
useful thing all around.

~~~
qwertyuiop924
It depends on what lisp you pick. And while CL isn't my favorite, if you're a
Common Lisp user, some of that stuff's already there for you.

But yeah, the JVM is a great platform. But Java is inseparable from it, and
Java isn't a great language.

------
titzer
This is brilliant!

> Reverent. Whether you belong to the Kingdom of Nouns or the Church of
> Lambda, be respectful of all faiths. Better yet, take the best of all worlds
> when designing your language (see: my previous post). Don't force users to
> pick one paradigm over the other, but rather be flexible enough to
> accommodate all walks of life.

If only.

But, that being said, I think all languages are coming around to adding first
class functions.

~~~
tracker1
What's funny, is to me F# and JavaScript would rank pretty highly in my mind.
Though JavaScript does allow for more varied paradigms of adoption, but not so
friendly.

~~~
douche
Comparing JS and F# is interesting... I would be very psyched if web browsers
implemented F# rather than JS. Type safety, with inference, would be a big
win.

------
bcheung
I saw trustworthy, loyal, and my mind immediately filled in the rest. I
haven't had anything to do with Boy Scouts in over 20 years and I still
remembered it flawlessly.

It's a shame the clean rule isn't found in programming languages more. I
really like low noise syntax of Python, Coffeescript, and Elm but it seems
like it is not really being adopted.

------
wyager
> Such a language should have ASLR enabled

Or, you know, just be memory safe.

------
ksubedi
All valid points. C# seems like it fits the criterias the best out of the
languages I have used.

