
Ballerina Programing Language - rukshn
https://ballerina.io/
======
mdasen
So, the home page makes some big claims, but doesn't link to how Ballerina
solves those issues. I'm not saying that it doesn't. I'm saying that it would
be nice to have a link to what makes it different for that aspect.

For example, "Structural, Open-by-Default Typing". It sounds really
interesting, but the image next to it just looks like what you'd get in Go
(except for nullability checks), C#, Kotlin, and many other languages. Yes,
static typing (especially with nullability checks) can make life difficult.
You have to make create-request objects that don't have an id in them or you
have to make the id nullable. Responses might include different fields like an
updatedAt. How do you convert between those types without requiring lots of
boilerplate conversion code that you're likely to mess up. But it doesn't
really say what it's solving. The saying about being liberal in what you
accept and strict in what you send is nice, but doesn't tell me anything.
_How_ does it achieve that without lots of code and checking? From the struct
on the left, it looks like I'll have to constantly check if id is filled
out...or have a CompleteResult type where id isn't optional. A link to an
example of what this means and how other languages don't solve it would be
wonderful.

Likewise, it says "The Network in the Language". Sounds like great marketing
speak that doesn't mean anything. Ah yes, "the fallacies of distributed
computing". _How_ does it solve the fact that networks aren't reliable in a
way that other languages don't?

I guess I always want to know the "how". Claims are easy, but for many of
these problems there's a reason why someone else hasn't solved them. Maybe you
have figured out a better way, but the site hasn't said what that better way
is. The example image for "Structural, Open-by-Default Typing" doesn't look
different from a Kotlin data class: it has statically typed fields, some are
nullable. Can I assign a string to an int field and it won't crash? What about
when I try to read it? What does "Structural, Open-by-Default Typing" mean?
From what I see in the image, lots of other languages have it and I don't see
how it enables the robustness principle.

Again, there might be great things in here, but the home page doesn't show
anything and the quick tour shows error handling that's similar to Rust (or
Go's with a short-cut to return the error like has been proposed for Go 2.

Instead of linking to a description of the problem on Wikipedia, it would be
great to link to a page with your solution and how it's a pain point in other
languages. Like, how do you abstract away the fact that the network is
unreliable? The quick tour shows a client requesting from an API, but the only
thing I see is a `check` keyword which is similar to the `?` operator in Rust
which just returns the error if there is one and unwraps the result if it
succeeded. It's a short-cut over Go's `if err != nil` and more explicit than
runtime exceptions, but it hasn't shown me how it's different from other
languages.

I guess I just need to know how someone solved a problem if they're saying
they've solved it. Yea, we all know that networks are unreliable. We all know
the pain of dealing with data that's slightly wrong over the wire. Link to how
you're making that better and how other languages aren't handling it well.

~~~
jclark_th
There’s lots of detail in the language spec:

[https://ballerina.io/spec/lang/2019R3/](https://ballerina.io/spec/lang/2019R3/)

I also wrote a blog explaining what we are trying to achieve:

[https://blog.jclark.com/2019/09/ballerina-programming-
langua...](https://blog.jclark.com/2019/09/ballerina-programming-language-
part-1.html)

~~~
grumpy8
Would be great to have that insight on the landing page. Most people
(including me) will first make a judgement call looking at the landing page
for a few seconds before deciding if they want to learn more and go through
the specs & examples.

------
gavinray
I have followed this language passively for ~1.5 years. I think it's
revolutionary, and the big barrier for my adoption is the fact that I do not
currently write services for the JVM.

But the ability to define services as HTTP/Ingress endpoints, Docker
containers, and Kubernetes/Openshift resources natively as part of the
language is incredible. Add that to the fact that they have native support for
things like tabular data and table queries as primitives, stream operations,
distributed transactions baked in, multiple kinds of service-level auth
natively, and a bunch of other goodies like observability/metrics primitives +
support for Kafka/OpenAPI/etc etc and you have one hell of a language.

Interoperability with the existing Java and JVM ecosystem is huge.

I would be unpleasantly surprised if this does not take off, or at least
similar concepts in other languages. Today, the closest thing you can get is
Pulumi for defining infrastructure + deployments in code, and then your
regular application codebase on the side.

If you want to see a featureset that a modern language built for web-services
& cloud-native architecture should strive for, check out their learn-by-
example list (in particular, the items past basic grammar & syntax):

[https://ballerina.io/v1-1/learn/by-
example/](https://ballerina.io/v1-1/learn/by-example/)

~~~
lmilcin
I looked through examples and I don't see what's so revolutionary about it.

This is specialized language suited for more or less one task that has nothing
specialized for that task which cannot be rolled in Clojure in a day or two.

Challenge me, give one example that can't be done as easily with Clojure.

~~~
eyelidlessness
Static typing

~~~
lmilcin
Static typing is a property of the programming language, not something you
"do". Do you mean your clients want static type something?

Static typing is a preference of the developer or development organization on
whether they want speed or they need a bit of help to understand what they
have before their eyes. It lets the compiler call you out on some of your
transgressions at the cost of quirky type system and possibly having to need a
bunch more code where a very simple solution would present itself when type
system does not get in the way.

Static typing is neither bad or good. It "depends".

~~~
eyelidlessness
I didn't make any value claims about static typing (though I do prefer it), I
just answered the question of what "can't be done as easily with Clojure". You
cannot easily statically type Clojure, and as a consequence cannot easily do
any of the things that static typing enables in a language, regardless of how
much you value those things.

------
mkl
Previous discussion from a few months ago:
[https://news.ycombinator.com/item?id=20924552](https://news.ycombinator.com/item?id=20924552)

------
noelwelsh
I like the idea but I'm not impressed by the language. Syntactically there is
a lot of noise (e.g. semicolons, function types are incredibly verbose). It
seems to be missing generic types, pattern matching doesn't seem to express
structural recursion, if is not an expression, etc. etc.

~~~
jclark_th
The language has a lot of syntactic compromises, because it has a design goal
of being familiar to users of C-family languages like C, JavaScript, Java, C#,
etc.

~~~
dragonwriter
But several of the listed problems don't exist in many of the listed languages
or close relatives (I wouldn't really call JavaScript C-family either, as,
except maybe C-style for-loops, it has nothing that distinguishes C from other
Algol-syntax languages, and other than Algol-style syntax it's more a blend of
ideas from Lisp and Self than anything related to C), so those flaws cannot be
necessary for familiarity to users of those languages (Java, C#, and several
of JS’s statically-typed derivatives that are designed to be familiar to JS
programmers, like TypeScript, have generics, so “missing generics” doesn't
make sense as a familiarity compromise for users of those languages.)

~~~
jclark_th
I didn't say that all the listed problems were caused by the goal of being
familiar.

It doesn't yet have generics because they are hard to get right and the
language is still at an early stage. Many languages that subsequently added
generics did not have them in the earliest versions of the language (C++,
Java, C#, TypeScript, Go).

------
anigbrowl
This is the best landing page/documentation I've seen in a while. The examples
with detailed comments are really outstanding.

~~~
albertzeyer
I totally disagree. After reading the landing page, I have no idea what kind
of programming language this is.

Someone else mentioned this is based on JVM. There is no mention of JVM on the
homepage. So, is it based on JVM? Or some interpreted language? Or compiled to
native code?

"The Network in the Language" What does this mean?

"Sequence Diagrams for Programming" What does this mean?

"Structural, Open-by-Default Typing" Looks pretty standard?

"From Code to Cloud" What does this mean? Just some nice tooling?

"Batteries Included" Like most other languages.

"Developer First" What does this mean? What's different to other languages?

This sounds all like marketing fuzz, without telling actually any information.
Really. I have no idea what this language is about.

Is this a competitor to other JVM languages? Or to system languages like
C++/Rust/Nim/etc? Or to languages like Go/Erlang? Or to languages like
Python/Ruby? And what's special about this language?

mdasen summarized my complaints in a nice way:
[https://news.ycombinator.com/item?id=22402053](https://news.ycombinator.com/item?id=22402053)

~~~
throwaway894345
My understanding is that Ballerina has semantics for defining multiple
services in the same program, and it “compiles” to a set of containers and
cloud configs that allow these programs to talk to each other. So very
basically it’s like putting Kubernetes or AWS into a language. But there
documentation is pretty unclear as many others have noted so I really doubt my
interpretation is precisely accurate.

------
jb3689
This is what the future of programming languages should look like. Not
necessarily syntactically, but with full-fledged systems out of the box. We're
not getting further as a community by just building new source code to plug
into our Docker/Kubernetes/Chef/Terraform/gRPC monstrosities. Something needs
to tame that complexity. I love that things like sequence diagrams are first
class. I've made barely any of these since college and I'd love to see us be
able to truly get to working at that level day-to-day

------
cryptonector
> Ballerina is an open source programming language and platform for cloud-era
> application programmers to easily write software that just works.

Meaningless tagline.

> Static typing is the network application programmer’s development headache
> and dynamic typing is the reliability engineer’s nightmare. Ballerina’s
> statically-typed, structural type system that is designed to be network data
> schema friendly allows application programmers to write code that adheres to
> the Robustness Principle: Be conservative in what you send, be liberal in
> what you accept.

Nowadays we recognize that this is not necessarily a good idea. Se the very
long ietf@ietf.org thread titled "deprecating Postel's principle - considered
harmful".

------
pnathan
I saw this at Kubecon 2018 and even got a sweater from the folks there. The
idea of an all-in-one soup-to-nuts system is pretty unusual these days.

So, this is a _fascinating_ project. I don't know how I'd introduce it at a
company though. Maybe in a skunkworks group or something. Possibly if I was
working as some sort of middleware-integrator group.

The JVM bits don't bother me, but it does make things heavierweight than I'd
like.

Curious if anyone is using it, it seems to have tons of potential.

------
Piisamirotta
"Yet, no current programming language lets you write your logic as a sequence
diagram."

Welcome to automation (PLC) programming where sequence programming has been
around since 80s.

------
kazinator
> _Robustness Principle: Be conservative in what you send, be liberal in what
> you accept._

That's a debunked principle that causes unintended harm.

Programs should be conservative in accepting just their documented range of
inputs, and loudly rejecting and diagnosing anything else.

Any behavior that looks "liberal" should actually be so by a specified design,
within exact limits, operation outside of which is ideally flagged and
rejected.

~~~
hhas01
Misunderstood principle. Liberal does NOT mean Malformed.

As you say, all behaviors should be fully specced, and inputs that violate
that spec should rightly be rejected. It’s the spec itself that should be
forgiving.

e.g. Don’t _require_ fields for which sensible defaults can be assumed. Don’t
be needlessly anal about case and white space variations. Maintain backwards-
compatibility by continuing to accept older input formats alongside the latest
and greatest. Accept ints where floats are expected. And so on.

HTTP is a good application. Whereas the eejits who invented HTML have a
helluva lot to answer for.

~~~
kazinator
Yes, the principle does actually mean that nonconforming inputs should be
accepted. Well, only if someone has decided that their meaning is clear. But
that is rarely so if you're outside of the spec. The intended meaning of a
bunch of bits (syntax) can be anything, or nothing at all.

Sensible defaults can't be assumed; they have to be specified. My sensible may
be your silly.

If a spec defines certain parameters, and neglects to say anything about their
defaults, and an implemention assumes defaults, that will cause issues.

Firstly, the user will break if they go to another implementation which
rejects their data. It's not that implementation's fault; it's just catching
the error of missing values with unspecified defaults.

Worse, the user's data can silently be interpreted with some different
defaults.

You have to be exactly as anal about case and white space variations as the
spec says.

A C compiler or linker can't treat PrintF as printf just because the meaning
seems clear enough, and PrintF has not been declared or defined.

> _Whereas the eejits who invented HTML have a helluva lot to answer for._

In my original version of the comment I used HTML as an example, but decided
to omit that.

The problem wasn't the invention of it (though that doesn't escape criticism)
but rather the fact that during early Web history and during the first Browser
War era, browsers tried to accept non-conforming HTML and render it anyway.
Thus people writing bad HTML had no feedback. The pages looked good with
whatever browser they tested with. So browsers had to scramble to reverse
engineer and imitate each other's handling of bad HTML as good. The effects of
that situation persist; it's not fully resolved.

That will happen with any interchange or storage format, if treated with
Postel's principle.

Postel's principle is from the point of view of keeping the internet working,
in a situation where messages pass through multiple hosts, which are
inaccessible to either the sender or the receiver. If something is rejected
due to violating a rule, there is no diagnosis; the symptom looks the same
like a severed cable at the bottom of the ocean. It's understandable where
that came from.

Postel's principle somewhat applies to intermediary data handlers.

If you're just routing messages, and see a message that you don't understand,
then just pass it along.

The principle should be "have as little effect as possible; look at only the
parts of data needed to do your job, and don't interpret and act on payloads
that don't belong to you; try hard to route rather than drop."

------
hestefisk
“Network in the language” has to be a deliberate reference / kudos to Sun’s
famous slogan “the network is the computer”.

------
dead_man
I saw their demo at Kube-Con Barcelona. Pretty cool stuff. They deployed the
sample into kubernetes by generating YAML and docker via the compiler. An
aspect that other languages should think of.

------
IshKebab
> Be conservative in what you send, be liberal in what you accept.

I can't believe we haven't all learnt the lesson of how much of a bad idea
this principle is. Has this guy not heard of HTML and quirks mode?

~~~
erik_seaberg
Only because nobody ever persuaded document authors to be conservative
(strictly schema conforming) in what they send.

~~~
DagAgren
And that is because everyone was liberal in what they accepted, so there was
no need to.

------
kalium_xyz
Session types do exist in other programming languages. Unlike what the site
seems to imply.

