
Ballerina, a language with structural type system - rdhananjaya
https://v1-0.ballerina.io/
======
yoz
Excerpted quote from their launch blog post (
[https://blog.ballerina.io/posts/annoucing-1.0.0/](https://blog.ballerina.io/posts/annoucing-1.0.0/)
):

> That obviously starts with the Enterprise Integrator team as that is where
> this baby was flirted with, dated and then conceived;

This is what happens when people think that coding is hard but writing is
easy.

WSO2: Please, on behalf of innocent eyeball-owners everywhere, _hire a
dedicated content editor._

~~~
hhas01
You don’t even need to read past the product name. Like a lot of geeks they
just don’t have a clue how to sell, nor how to hire talent that can. There is
no part of their branding that is not a straight disaster. (And that shoulder
massage…oy.)

Look, real ballerinas are totally hardcore badass atheletes who could easily
kick all our flabby nerd asses while standing on one toe, and I take my hat
off to them for what they do. But how many professional software developers
will really want to self-identify as “ballerinas” when discussing between
themselves, never mind pitching to board rooms?

(Outside of the programmers-who-already-happily-self-identify-as-bronies
subset, of course.)

Doubly so when the actual product looks as agile and graceful as a household
broom.

Triply so when they can’t even do simple web pages right. (Just try the inline
links on the Community page.) Or try the learn-by-example page, which spends
seconds looking completely blank until some pointless Web 2.0 crap eventually
loads in a perfectly static TOC.

I mean, I was prepared to overlook the marketing catastrophe just to read
about their much vaunted take on structural typing (which is highly relevant
to my interests), but this simple lack of technical competence means I am not
going to waste any more time.

Money says the whole thing immediately sinks without trace, and none involved
will ever be any the wiser why. What a pointless waste of effort.

~~~
Guthur
You see a shoulder massage, I see someone giving support to and obviously
nervous programmer :)

Granted though I can't see where the name is coming from.

~~~
hombre_fatal
Yeah, just seems like maternal guidance to me.

People nitpicking the gender of the programmer in a cartoon here is a great
example of what I despise about modern tech discourse. The gender of the
cartoon programmer isn't even that clear, it's so highly stylized. But I
wonder if it was a woman giving another woman a massage instead, they'd be
lambasted for pandering to the male fantasy of lesbianism.

~~~
carapace
Well I see a _Leanan sídhe_ sucking some mysterious lifeforce out of the
programmer while "stimulating certain areas of his brain". I don't know what
to make of that.

[https://en.wikipedia.org/wiki/The_Muse_(Star_Trek:_Deep_Spac...](https://en.wikipedia.org/wiki/The_Muse_\(Star_Trek:_Deep_Space_Nine\))

------
vinodkd
Always happy to see another language being born, especially one that's put
together like this - assuming all of it works (have not yet downloaded or
played with it, this is based on reading your website)

That said:

1\. This is bikeshedding, but you cannot make a statement like "diagram is the
code, code is the diagram" and not show how to actually do that. The home page
even has a sequence diagram. If you meant that the written code looks like a
sequence diagram if you squint, then say that.

2\. What makes this a Perlis language? I knew every term in the by example
summary [1]. Is it annotating functions as services with metadata, or in-
language support for xml/json, websockets/http2, etc? How is that different
from other batteries-included languages like wolfram, for example?

3\. Related: the problem with a batteries included language is that it gets
bigger and bigger over time; hence the idea of "small language, large library
base". What will you do with the language when its usage pivots over time -
add more batteries as standard?

4\. Minor: Many links to GH on the community guide page [2] end in 404s.

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

~~~
jclark_th
Here's what the spec [1] says about the sequence diagram aspect of the
language: "[Ballerina's] abstractions and syntax for concurrency and network
interaction have been designed so that there is a close correspondence with
sequence diagrams. This enables a bidirectional mapping for any Ballerina
function between its textual representation in the syntax described in this
specification and its graphical representation as a sequence diagram, such
that the sequence diagram fully shows the aspects of the behavior of that
function that relate to concurrency and network interaction."

The two biggest things that are different about Ballerina in my view are the
language abstractions for providing and consuming network services, and the
correspondence with sequence diagrams.

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

~~~
vinodkd
Can you share a sample of code, its equivalent sequence diagram, and how one
is converted to the other please? I see that the samples have caller->method()
style code, but how is this a sequence diagram? And where's the actual bidi
mapping?

To be clear: I'm not critical; its good that ballerina attempts to bridge the
visualization and the implementation. I'd like to see an actual sample,
though.

Edit: Never mind, found the other poster who discovered your IDE plugin that
shows the sequence diagram equivalent. Not sure how this is part of the
language, though.

------
dgreensp
I've never heard of this language, but it looks like a cross between
TypeScript and Java. The "Why Ballerina" points on the front page are
intriguing, but none of the other materials seem to fill in the next level of
detail. The diagram is the code... so this is a visual language? Where are the
example diagrams? The language is built so that it's easy to access a service
over a network? Tell me more. Show me something beautiful, dammit. The syntax
isn't pretty. And why does every new programming language these days put
"getting started" instructions above the fold, but not show you code or
otherwise give you something concrete to latch onto?

I'm speechless at the sheer amount of documentation and tooling that already
exists. Editor plugins, a code formatter, a style guide, a build tool, a doc
tool, a package manager, a package repository, a language spec, a standard
library, a framework for writing services, deployment guides, and maybe 200
example programs.

I am a major TypeScript fan and former major JVM fan, and I can see the appeal
of mashing them up. I think my problem is that the front page is the only
interesting page on the entire site, the only one that gives me some sense of
why I might care about this obscure language, let alone use it.

~~~
OJFord
There's a link to 'by example' docs at the top, next to download:

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

~~~
Vivtek
If that page has a single example with a diagram in it, I have yet to find it.

~~~
sanjiva
It doesn't. The primary reason is that VSCode cannot be hosted.

We will soon publish a playground widget which will let you run the same code
in the browser so you can see source and the diagram as you wish (or not!).

------
ScottPJones
I've been programming in the Julia language for the past 4.5 years, and as
somebody who has lived through the problems with Julia's name (getting
incessantly teased by coworkers, friends, even my wife and kids, because of
how much I like the Julia language and tend to gush about my enthusiasm for
it), I think @StefanKarpinski really has hit the nail on the head here.

His suggestion of "Ballet" is very good, it still conveys all of the grace,
elegance and beauty of ballet. Also, ballet dancers of all genders are pretty
kickass athletes as well as incredible artists and performers.

Come to think about it, maybe I shouldn't recomend them changing from
"Ballerina" to "Ballet", because if I came up with a new language, "Ballet"
would definitely be pretty cool, and I'd want to use it myself!

------
StefanKarpinski
As a co-creator of a language (Julia) with a name that is feminine in most of
the world, let me give some friendly advice regarding the name "Ballerina",
which means "a _female_ ballet dancer". The way you talk about Ballerina comes
off rather tone deaf to gender issues. In the post linked here and elsewhere
on the language website, the female ballerina—and she is definitely a she—is
talked about as an object of grace and beauty to be appreciated by the
programmer, who is presumed to be male. In one cartoon on the site, the male
programmer is getting a massage from the helpful, friendly, female Ballerina
while he does his programming work. And then there is language like this
(pointed out by @yoz):

> That obviously starts with the Enterprise Integrator team as that is where
> this baby was flirted with, dated and then conceived

This is really damaging: the Ballerina in question is referred to as "baby",
she is flirted with and then conceived—weird because that's an unusual order
of events, but I guess this means you knocked her up and then had a baby with
her? I can't continue, even dissecting this sentence feels creepy. Just don't
do this. It's weird and disturbing and it will put off most women and many men
who might otherwise consider using or contributing to your language.

Consider renaming the language to "Ballet", which is distinctly non-gendered
and doesn't have these issues but still suggests the grace and beauty you are
inspired by and aspiring to. Seriously, consider this. Yes, it's late in the
game (post 1.0) and you like the name you have, but it's close enough to the
current name that you won't lose much branding and you can keep the same nice
logo that you already have.

If you are going keep the name Ballerina, you cannot sexualize the name and
you should have a rule that others in the community not do so either. Julia
has a specific rule in the code of conduct saying "do not sexualize the name
of the project"—we didn't originally think we'd need to say that, but it turns
out people just cannot resist saying creepy, sexual shit about anything they
perceive to be feminine.

~~~
jclark_th
Thank you for your comments. Both the cartoon and the sentence you highlighted
have been fixed. We want to create an environment where everybody feels
welcome. Your rule about not sexualizing the name seems like an excellent
idea.

~~~
StefanKarpinski
Glad that feedback was useful. I know it’s not a thing to consider casually,
but please do start a real discussion about changing the name to
Ballet—deciding not to is a viable outcome, of course, but do have the
discussion. It could save you a lot of trouble over time. Even if it seems too
late, I think it’s one of those things that will seem in hindsight that it was
actually very changeable at this point in time.

~~~
sanjiva
Ada was named after Ada Lovelace too. Many may not know that it was a woman's
name (and of course few program in Ada; we certainly hope for a better outcome
than that!).

I'm sorry but I cannot accept the argument that because its a feminine word
its not an appropriate name for the language. Gender balance has been a
problem for this industry and making it so all names are male so people won't
feel bad to say they like it is ridiculous. I worked hard in WSO2 to create an
open workplace for women and 30% engineers are women - so it is possible to
make it better if you try hard. Isolating tech to male-only names is not the
solution.

As James noted, I updated the blog I wrote (even though the words were not
meant the way you presented them) to remove that offending bit. And indeed
your points about incorporating "do not sexualize the name" are great and
we'll put them into our terms of conduct.

~~~
StefanKarpinski
There’s nothing wrong with a feminine name, just be aware of the issues. The
name Ballet would avoid many of those issues outright, lessen the need to have
such a rule, and seems like it might be a better name anyway—it’s shorter and
phrases like “I love Ballet” and “we used Ballet” work. It’s your project, of
course, it just seems a conversation worth having.

------
k_
> In Ballerina, every program is a sequence diagram that illustrates
> distributed and concurrent interactions automatically. The diagram is the
> code. The code is the diagram.

I'm not sure it's a feature I'm missing in current languages, but I sure am
curious about this. Maybe "ballerina by example" should implement a toggle
between diagram and code views?

~~~
OJFord
Given the end of your quote, what's to toggle between?

(I think it means that the code does clearly enough the interactions that you
don't need a separate diagram, rather than that there's built in tooling to
generate one, if that's the confusion.)

~~~
roonyh
There actually is a built in tool to generate a sequence diagram. The language
is designed with the idea that it should be possible to generate such a
diagram for every program. The tool to generate diagram is currently part of
the vscode extension for ballerina. It's documented here.
[https://v1-0.ballerina.io/learn/tools-ides/vscode-
plugin/gra...](https://v1-0.ballerina.io/learn/tools-ides/vscode-
plugin/graphical-editor/)

~~~
h0h0h0h0111
The way I read the docs though, it sounded like you could generate code from a
sequence diagram - generating a diagram from code isn't that new or unique
(albeit, still a handy feature!)

~~~
OJFord
If you look at GP's link, you can see that the VSCode integration (perhaps
others too) allows editing either the code or the diagram, and it's propagated
to the other in real time.

I'm not certain it's unique, but it's pretty neat, and I can see how designing
the whole language around servicing network requests would make it easier to
implement / more reliably work.

------
mkl
Every time a new programming language is announced, I go look at some of the
example programs. This time I didn't even make it through "hello world" as I
can't read the grey on very slightly lighter grey code.

Please, if the makers are reading this, just make it look like it does in your
editor, when you're reading and writing it.

~~~
sanjiva
Yeah sorry .. the styling on examples [https://v1-0.ballerina.io/learn/by-
example/](https://v1-0.ballerina.io/learn/by-example/) might be a bit much.

We'll work on it.

~~~
udkl
Also the comments. They are unnecessary in many places in the examples and
distracting. It’s obvious that the piece of code is “return string to caller”.
The comment is just noise.

~~~
sameerajayasoma
We will do another pass on these examples pretty soon. Thanks for the
feedback.

------
reilly3000
I played with Ballerina about 6 months ago. I wasn't able to sell it to my
team, but I was extremely impressed. Type safety, brilliant Kubernetes
deployment, and a very rich API for integration tasks made it appealing for
'glue code'.

If you're considering spending 5 mins to write a comment on why we don't need
this language, please consider spending that time with their examples page
instead. Its pretty impressive in breadth and depth.

I do think that the whole diagram bit is noise, and I could never really get
it to work as expected in VScode. Its just a solid language for service
development.

------
aloknnikhil
Visual programming languages are great in concept until you actually start
using them. Luna-lang, for example, promises so much but severely lacks in
delivery. This claims to convert sequence diagrams to code, but is it really
production quality? If not, is this purely for prototyping? Not that that's a
bad thing. Honestly, these claims are all starting to sound very repetitive.

~~~
Davidbrcz
SCADE provides textual and graphical views that are synchronized and it's
widely used in industrial critical embedded software such as airplane in
airbus.

~~~
solarkraft
Why (do you think) is it only used there and hasn't made its way too the main
stream (yet)?

~~~
Davidbrcz
Disclaimer: Huge personal hunch, might be down-voted to hell for writing
this...

I think that languages like this don't go mainstream because people like/want
to _write code_ , and anything that does not help to _actually write code_ is
seen as an hindrance. The main feedback I've heard about this kind of tool is
"it's clunky, it's a pain to write code with". Guess what ? It's a good thing
IMO.

For this to go mainstream, the whole software industry would have to go
through a major revolution by shifting its focus from "writing code" to
"deliver a working product". We should acknowledge that "writing code" is one
tool among others, and may be not even the primary one (I personally think
that specification engineering is the most important one).

In the field of critical embedded software, this has happened that's why it
took off.

Another clue of that is for instance the Event-B/Atelier B that is intensively
used in the railway/metro world (Paris line 14 was made with it, 2 bugs found
in 15 years). While doing B, you get a broad specification you refine along
the way into smaller problems. Writing code is actually the last step you do,
when you are sure that all pieces fit together.

~~~
imtringued
Learning how to write code isn't a significant barrier. It's just pressing
buttons on a keyboard. Logical thinking and problem solving are far more
important. Switching to a visual language doesn't actually help you with that.
Worse, if clicking virtual buttons with a mouse is slower than pressing
physical buttons you will waste mental capacity that could have been used for
problem solving and logical thinking.

~~~
Firadeoclus
Logical thinking and problem solving can greatly benefit from visual
representations and feedback. I write code but I often wish the representation
was much more visual than lines of dense monospaced text with a little bit of
colour. Diagrams are often easier to parse and reason about. When trying to
understand difficult code or figuring out a difficult problem before writing
code I generally draw diagrams with pen and paper. These diagrams are much
closer to my mental model than code, and I wish that a lot more of this
translation could be automated.

"Visual language" doesn't have to mean low-bandwidth interactions.

~~~
cormacrelf
> more of this translation could be automated

It seems to me that when creating a visual programming language for a
particular class of programs, you probably find that making this translator is
the same hard mental work that would let you make a text-based programming
language instead. Once you have a good mapping from thoughts to code, the
visual part doesn't add much. I was talking to a non-programmer recently who
had tried Scratch and gotten tired of the visual layer very quickly. It's rare
to see a visual -> code mapping that retains value after you've used it the
first time, i.e. value beyond teaching.

I like the general idea of going the other direction, from code to diagram.
I'm not interested in editing the diagram, but it's great for reading the code
and sanity checking. But it doesn't have to be the actual code. A great many
projects would benefit from having a GraphViz generator instead of hundreds of
printlns. I was talking today about adding a GraphViz .dot visualisation to
the salsa-rs incremental computation database, because I was reading the
documentation on garbage collection and just wanted to see it in action. I
know the rustc folks have been doing this for ages.

I think in addition to generating graphviz, it would be cool to have a log
viewer that can render it.

    
    
        $ my-program
        normal logs
        viz:"digraph {\n0 -> 1..."
        more normal logs
        ^C
    
        $ my-program | logviz
        normal logs
        more normal logs
    

... and a window pops up that animates changes between each graph that appears
in the logs. Or even better, a tool that takes regular printlns of edges,
nodes, etc, interprets them as an append-only variant (with deletion, etc) of
graphviz, and assembles them into a graphical representation that changes on
the fly. So you don't need to have a graph implementation in every language
you want to do it with.

~~~
Firadeoclus
> Once you have a good mapping from thoughts to code, the visual part doesn't
> add much.

Having the visual representation readily available is indeed "great for
reading the code and sanity checking". Writing code (here meaning text or
visual) involves reading code, both the code you're currently writing and
anything that is connected to it. Thus the visual representation is also good
for writing code.

I'm not advocating a low bandwidth interaction model. I can certainly see why
some people might quickly grow tired of Scratch, but I'd argue that's a
problem with the specific language/editor, not something that is universally
applicable to anything that tries to go beyond "text". Structured editors can
beat text editors in interaction speed.

------
orthoxerox
Like other WSO2 stuff, Ballerina suffers from too many almost complete
features.

As I see it, they can hire dozens of coders in Sri Lanka, but don't have a
good product management team that can turn a 95% complete feature into a
market-ready one.

~~~
sanjiva
I'm the founder of WSO2. I'm from Sri Lanka. We have 100s of coders from Sri
Lanka (not dozens). I'm the creator of Ballerina. I'm now its product manager.

Ballerina is in its first GA release. Please elaborate on what features you
see as "almost complete"?

And regards to your comment about WSO2's inability to produce market-ready
products, we have 500+ customers from all over the world for our products.
What do we need to become "market-ready"?

~~~
rurban
Hi Sanjiva, I'm impressed. Of the product, and that you have that many
excellent Java coders in Sri Lanka. Didn't expect that.

Java really needs a safe structurally typed product. What are the major
differences to Scala?

~~~
otobrglez
This was exactly question in my mind as well when I saw Ballerina.

What are the major differences to Scala with Akka?

------
joatmon-snoo
> Yet, no current programming language lets you write your logic as a sequence
> diagram.

This is not a bad thing per se. If I make a diagram, I want to be able to
understand it.

WTF is the sequence diagram for request hedging going to look like?

------
nickserv
Perhaps not the best introduction when the site gets an "unresponsive script"
pop-up on mobile Firefox.

------
amitport
They really should explain the motivation in the main site instead of just
expecting me to download and experiment.

~~~
udkl
Yup, the front page is very text dense with abstract concepts but fails to
address important questions their main target audience would want to know.

------
kcmastrpc
I've been to several dozen technology conferences the past two years and these
folks show up with a fancy large booth and nice swag and I'm simply amazed at
the presentation and effort they've put into this undertaking.

My understanding is that the primary motivation all of this is consultancy
work in India.

~~~
sanjiva
I'm the founder of WSO2 which developed Ballerina. Also the person who started
the project and lead it.

WSO2 is an enterprise software product company with 500+ customers in 70+
countries and 600 employees globally.

We promoted Ballerina like that because we are proud of the work we do and
wanted to show it off to people. You may not like the work we produce but
trying to say its to get "consultancy work in India" is rather racist.

~~~
tasuki
> I'm the founder of WSO2 which developed Ballerina. Also the person who
> started the project and lead it.

Congrats and thank you!

> We promoted Ballerina like that because we are proud of the work we do and
> wanted to show it off to people.

And rightly proud!

> You may not like the work we produce but trying to say its to get
> "consultancy work in India" is rather racist.

Saying it's to get "consultancy work in India" might be wrong (you promote
Ballerina because you're proud of your work), but I fail to see how it's
racist. Even if it was true, it wouldn't be racist.

~~~
mindB
I think the racist bit might be assuming the primarily Sri Lankan company is
from India.

~~~
sanjiva
No, the racist bit is the implicit assumption that people in this part of the
world can only do services and not creative technology development.

We can do both, just like anyone else in any country.

------
err4nt
I've had my eye on this for a while, it looks great! Co-designed by James
Clarke (of SGML, DSSSL, and XML fame) and it uses XML as a built in native
data type.

I don't do cloud stuff but I can't wait to give this a spin and see if there's
any way I can use it to my benefit.

------
alexashka
The absence of meaningful code samples on the front page, and the request that
I install software on my computer to try a few lines of code, makes me highly
doubt the future of this endeavour, outside of academia.

~~~
sanjiva
We had a playground widget but had to take it down because we were a bit
swamped last few weeks and couldn't get it updated for this release.

A Go-like full screen online playground is coming.

------
F-0X
I just need to say it. _Thank you_ for putting types on the left.

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

This is now widely considered a terrible idea because it encourages software
that doesn't conform to specifications, e.g. HTML's "quirks mode".
[https://i.stack.imgur.com/teQdv.png](https://i.stack.imgur.com/teQdv.png)

~~~
fanf2
This Internet Architecture Board draft was initially titled “Postel was wrong”
[https://tools.ietf.org/html/draft-iab-protocol-
maintenance](https://tools.ietf.org/html/draft-iab-protocol-maintenance)

------
haolez
If the performance is good and if network/service errors can be handled and
recovered easily and gracefully, I might consider it.

------
aldanor
[https://v1-0.ballerina.io/learn/by-example/json-
io.html](https://v1-0.ballerina.io/learn/by-example/json-io.html)

    
    
        returns @tainted json
    

made me cringe a bit for some reason.

~~~
vinok88
You should be, that is expected by the language. You are going to receive some
untrusted data, be careful when you use them.

------
gigatexal
Been following this language for a while now. Good to see them hit 1.0

------
chrisweekly
Mods: typo in title

langauge -> language

------
JaDogg
Good work

------
webkike
I can’t say much about the language, but I think the image at the bottom is
somewhat inappropriate. Why is there a woman massaging a man while he uses a
computer? I understand that this is to illustrate comfort, but this is not an
appropriate way to illustrate that

------
deamon_lang
Another half baked wso2 product.

~~~
rdhananjaya
Could you please elaborate a bit, which part of the language you think half
baked?

~~~
deamon_lang
Can you execute OS exec with this language? I tried to do the integration with
a legacy app and gave up.

~~~
rdhananjaya
Here you go, [https://v1-0.ballerina.io/learn/api-
docs/ballerina/system/in...](https://v1-0.ballerina.io/learn/api-
docs/ballerina/system/index.html)

~~~
llarsson
I browse with JavaScript off, and I can't scroll on that site. Could you
degrade it more gracefully, please? It's a documentation site, after all, not
something that should be design heavy.

~~~
rdhananjaya
I created an issue for you [https://github.com/ballerina-platform/ballerina-
www/issues/1...](https://github.com/ballerina-platform/ballerina-
www/issues/1594)

