News for hackers. Stuff that matters.
Re:Blech Programming Language by sesm on Friday September 18, 2020 @11:14AM (#24517800)
To me the most interesting part is this: https://www.blech-lang.org/docs/user-manual/moc/

From what I understood, Blech's solution for concurrent data access is this: 1. Writes are queued during 'reactions' and applied in-between 'reactions', last write wins. 2. Static analysis ensures, that there is only one writer for each global variable in so-called 'fork-join scope', I guess it's a scope of code that can be executed during one 'reaction'.

This is conceptually somewhat similar to MVCC, but only one writer is allowed.

Re:Blech Programming Language by p4bl0 on Friday September 18, 2020 @08:31AM (#24515831)
It's a nightmare to find examples of Blech code on this website. All I could find after a dozen of clicks is zip archive to download that should contain sample code in them…

Anyway, how does it compare to Lustre for example?

Re:Blech Programming Language by euske on Friday September 18, 2020 @09:26AM (#24516456)
Agreed. So much for a "new language" that doesn't want to show off what an actual code looks like.
Re:Blech Programming Language by tyingq on Friday September 18, 2020 @08:49AM (#24516012)
I had the same experience, but did eventually find this blog post with some example code snippets:

https://www.blech-lang.org/blog/2020/08/12/push-button-handl...

Also, figured out the "compiler" transpiles to C. Which seems reasonable given that it targets embedded real time.

Re:Blech Programming Language by ivanbakel on Friday September 18, 2020 @09:23AM (#24516423)
The compiler/transpiler distinction is very blurred. Nobody disputes that LLVM-IR-targeting compilers compile programs, but the LLVM IR is not an executable. `javac` "compiles" programs, but the JVM bytecode is not machine code.

There's also no need to "figure out" that it compiles to C. That's in the second line of the front page.

Re:Blech Programming Language by tyingq on Friday September 18, 2020 @09:29AM (#24516486)
I went straight to looking for code samples. Hence, "figured out". And I thought I was clear that transpiling to C made sense to me for this space. You seem to be reading something in my comment that I didn't intend to be there. Apologies for any unintended odd tone.
Re:Blech Programming Language by turbinerneiter on Friday September 18, 2020 @10:56AM (#24517551)
Maybe don't to straight for code examples?

They have a pretty good write up about the design of the language.

Programmers are all hung-up on syntax, when semantics are key.

Re:Blech Programming Language by tyingq on Friday September 18, 2020 @09:09PM (#24523822)
"Maybe don't to straight for code examples?"

Pretty sure that isn't just me. It's a common path that works better if you have the docs for it, versus "download this tar.gz file".

Had I been on my desktop, that would have worked okayish. My mobile doesn't like tar.gz files, so I was stuck.

It's an opportunity to grow with mimimal effort.

Re:Blech Programming Language by ReactiveJelly on Friday September 18, 2020 @11:08AM (#24517722)
Here is the Rust book explaining ownership with lots of syntax-highlighted code examples:

https://doc.rust-lang.org/book/ch04-01-what-is-ownership.htm...

The 2nd search result for "golang goroutines" is gobyexample.com, which is 1 page, half of which is code:

https://gobyexample.com/goroutines

I need to see code to understand semantics. Otherwise I'm being asked to visualize something that is better displayed on-screen. Why am I doing the computer's job?

Re:Blech Programming Language by amedvednikov on Friday September 18, 2020 @10:57AM (#24517558)
I guess it's the quotes you used: "compiler".
Re:Blech Programming Language by turbinerneiter on Friday September 18, 2020 @09:03AM (#24516187)
Just read the docs in the intended order and on the second page you will find an actual example: https://www.blech-lang.org/blog/2020/06/15/decoding-the-dcf7...

It contains some real world, which is what embedded is all about.

Re:Blech Programming Language by egypturnash on Friday September 18, 2020 @08:54AM (#24516066)
> The German word Blech roughly translates to bare metal.

And here I thought it was gonna be some kind of comedy programming language; in English “blech” is an interjection expressing disgust.

Re:Blech Programming Language by DoofusOfDeath on Friday September 18, 2020 @09:14AM (#24516315)
I couldn't remember how to pronounce the German "Blech", so I just looked it up.

It sounds like the German uses a long "a" sound for the vowel. Liked you'd expect from "é" in a French word.

When I hear people say "blech" (the interjection) in English, the "e" is pronounced the same as first the "e" in "methadone".

Re:Blech Programming Language by dj_mc_merlin on Friday September 18, 2020 @10:28AM (#24517201)
It's just a normal length 'e'. About the same length as the 'ch' that follows. At least that's how I'd pronounce it.

But it can have a negative connotation in German too, unsure if the author of the language is aware of that.

Re:Blech Programming Language by danparsonson on Friday September 18, 2020 @09:48AM (#24516725)
I think Wiktionary disagrees, and I do too (but then again it's been years since I studied German): https://en.wiktionary.org/wiki/Blech - there is a subtle lengthening of the 'e' in their audio clip, but it's very slight. No doubt there are regional variations though.
Re:Blech Programming Language by DoofusOfDeath on Friday September 18, 2020 @09:53AM (#24516775)
I'm certainly not an authority on the topic. FWIW, here [0] is the basis for my original comment.

[0] https://www.youtube.com/watch?v=l9AmJTKYmZE&ab_channel=Visua...

Re:Blech Programming Language by danparsonson on Friday September 18, 2020 @12:53PM (#24519092)
I see where you're coming from; I guess the difficulty is really that we're forced to use an approximation from English to describe it because we don't have a sound exactly like that (how does the 'e' in 'Blech' sound? like the 'e' in 'Blech'!)
Re:Blech Programming Language by Joker_vD on Friday September 18, 2020 @11:07AM (#24517710)
Aren't the vowels of English "cat" and "bet" are pretty much allophones of German /e/ (which written either as "e" or "ä")?
Re:Blech Programming Language by progfix on Friday September 18, 2020 @09:45AM (#24516689)
> The German word Blech roughly translates to bare metal.

Not really. Blech means sheet metal or tin. Bare metal would translate to "blankes Metall".

Re:Blech Programming Language by jupp0r on Friday September 18, 2020 @11:14AM (#24517810)
Blech is sheet metal. It can be painted or bare, the term does not convey that aspect.
Re:Blech Programming Language by petecooper on Friday September 18, 2020 @10:24AM (#24517140)
Ah, Blech - fond memories of the mid-90s when these (completely unrelated) releases landed:

https://www.discogs.com/Various-Blech/release/30565

https://www.discogs.com/Various-Blech-II-Blechsdöttir/master...

Re:Blech Programming Language by neurotrace on Friday September 18, 2020 @09:15AM (#24516323)
Why is it so difficult to find example code? The very first thing that every programming language website should show is an example. Show me what sets your language apart from the others and let me see if I like the syntax.
Re:Blech Programming Language by rwmj on Friday September 18, 2020 @09:33AM (#24516537)
I thought I'd reply to this with a more direct link to the examples, but ... you're not wrong at all, even after a bunch of navigation through the documentation I cannot find a single self-contained program. There are some one- or two-line examples that give it a little flavour, but nothing significant. The full program examples are zipped up and I'm not going to bother to download those.
Re:Blech Programming Language by ReactiveJelly on Friday September 18, 2020 @10:57AM (#24517568)
> The full program examples are zipped up and I'm not going to bother to download those.

They could at least link to a Git repo.

When I click on the GitHub icon on "Download" it doesn't take me to GitHub.

When I click on "Contributing to Blech" the page is empty.

A repo with a README.md and bare uncommented source code would be more useful.

Re:Blech Programming Language by turbinerneiter on Friday September 18, 2020 @11:04AM (#24517662)
Re:Blech Programming Language by gkfasdfasdf on Friday September 18, 2020 @09:46AM (#24516697)
I finally found a few samples in the pdf tutorials. Agree putting some code samples front and center would be nice.
Re:Blech Programming Language by sesm on Friday September 18, 2020 @10:41AM (#24517359)
Some code samples can be found in `test/blechc/codegeneration`, I guess they serve as compiler test cases.
Re:Blech Programming Language by eternalban on Friday September 18, 2020 @10:25AM (#24517163)
This is likely a generational/cultural issue. Blech documentation seems comprehensive, and those who prefer reading specifications will have no problem with it.

That said, they also do give fairly comprehensive set of examples: https://www.blech-lang.org/docs/examples/

Looking at a 270+ loc example called 'virtualSafeLock.blc', picking a random initial example. (It's a pain, you have to unzip code archives, but it's there.)

Re:Blech Programming Language by ReactiveJelly on Friday September 18, 2020 @11:01AM (#24517630)
It's not cultural that if you generate static HTML with syntax-highlighted code, the viewer only has to click once, whereas a zip file requires 3 or 4 clicks, plus filesystem namespace, for an un-highlighted version.

If you want 100 people to view your website, isn't it fair to spend 50x of your own time as you can save of the viewer's time?

Re:Blech Programming Language by eternalban on Friday September 18, 2020 @12:13PM (#24518612)
If I am shopping around for an embedded systems language, I am more interested in reading about the runtime, any limitations, and the language spec. Technical considerations are top of the list. Thus "cultural".
Re:Blech Programming Language by turbinerneiter on Friday September 18, 2020 @11:09AM (#24517732)
Maybe they don't want people who refuse to spend 5 minutes on reading the docs, where they would find 3 complete, runnable examples.
Re:Blech Programming Language by throwaway33339 on Friday September 18, 2020 @11:23AM (#24517934)
Ah, this is what exclusive by design really means.
Re:Blech Programming Language by TheNewAndy on Thursday September 17, 2020 @08:26AM (#24503755)
In writing performance critical cross platform embedded code, I have found that exact width integer types are less useful than the "minimum width" style types you get from plain C (e.g. you can't write cross platform code with an 8-bit exact width integer type, because there is no such type on some platforms). It is disappointing to see this language provides no such types.
Re:Blech Programming Language by cesaref on Friday September 18, 2020 @08:30AM (#24515821)
Well since C99 there is an exact width C type for 8 bit ints, so i'm assuming you are targeting an obscure platform using a tool chain that is 20 years out of date
Re:Blech Programming Language by Athas on Friday September 18, 2020 @09:17AM (#24516348)
There is no guarantee that the hardware supports 8-bit numbers natively, and emulating them might be expensive. For embedded programming, it is sometimes useful to ask for a type that is at least 8 bits, but may be bigger.
Re:Blech Programming Language by fanf2 on Friday September 18, 2020 @09:51AM (#24516756)
That’s what int_least8_t or int_fast8_t are for

https://en.wikipedia.org/wiki/C_data_types#stdint.h

Re:Blech Programming Language by fjg on Friday September 18, 2020 @10:40AM (#24517348)
You can choose to use int_least_8_t or int_fast8_t as the implementation type blc_int8 of Blech type int8 for code generation https://github.com/boschresearch/blech/blob/master/src/blech... So you can adopt to your needs on your platform.
Re:Blech Programming Language by iainmerrick on Friday September 18, 2020 @09:48AM (#24516726)
Out of interest, are there particular platform(s) you have in mind?

I remember working with TI C5x DSPs which had 16-bit "bytes", but that was a long time ago. I'm curious whether there are still important embedded platforms that you might target with C and have unusual addressable word sizes.

Re:Blech Programming Language by 0x008 on Friday September 18, 2020 @09:04AM (#24516204)
How would one get into writing code for embedded devices or into embedded devices in general?
Re:Blech Programming Language by turbinerneiter on Friday September 18, 2020 @09:18AM (#24516357)
Arduino, PlatformIO and Adafruit.

Arduino is three things: an IDE, an actual development board and a hardware abstraction library. You only want the last one.

PlatformIO is a tool like npm or cargo - it manages dependencies and tool chains for you. It also has an IDE in the form of a VScode plugin, that is pretty nice, but you can also the CLI tools only (which I do).

Adafruit is a great company making development kits - PCBs with microcontrollers you can program. They also make a lot of breakout boards - i.e. sensor on PCBs that are easy to connect to the development kit. They also write libraries AND they write great tutorials.

If you like Python, there is also MicroPython - it isn't fast, but it is easy to use, you probably already know Python, and you still learn about embedded topics like GPIO, I2C, SPI and so on.

If you are into Rust, there is a strong working group for embedded in the Rust community and they also have some nice docs. Not so much entry level, tough.

Re:Blech Programming Language by 0x008 on Sunday September 20, 2020 @02:08AM (#24532205)
Yes I am into both languages. Thank you, I will check it out when vacation time is around :)
Re:Blech Programming Language by DoofusOfDeath on Friday September 18, 2020 @09:10AM (#24516269)
One lesson I've learned about myself, and it may apply to others as well:

The key is having a particular driving reason / motivator. I.e., learning the skill is a necessary hurdle towards some larger goal that you actually care about.

But maybe that's just me. I have a tendency towards procrastination and laziness, so I need a toolbox of tricks to not just sit around all day playing video games.

Re:Blech Programming Language by 0x008 on Sunday September 20, 2020 @02:08AM (#24532208)
So what are good things you can achieve? I for one would like to automate my plant watering, but I am not sure that is a compelling enough use case?
Re:Blech Programming Language by DoofusOfDeath on Monday September 21, 2020 @09:06AM (#24542853)
I wish I knew. Personally, I've never had success in generating artificial end-goals for myself as a way to motivate learning, physical exercise, etc.

The only motivators that have really worked for me are goals that I truly believed matter. E.g., losing weight to live longer, learning about compiler internals to keep making money for my family, learning certain woodworking skills because I really want parts of my house to not look terrible, etc.

Fortunately, I often find that I enjoy those intermediate steps/learning that I need to accomplish those real goals. E.g., I never would have expected to find compiler internals or woodworking to fascinating, but they became so when I needed to learn them.

But I've never had luck, for example, saying "I really want to learn how to write GUIs with Rust. What end goal could I create to motivate that?" I just never end up making time for those pursuits.

Re:Blech Programming Language by cyrc on Thursday September 17, 2020 @08:19AM (#24503682)
Blech is a synchronous programming language for embedded, reactive, realtime-critical software.

It allows writing reactive subprograms and combining them both sequentially and concurrently. Blech compiles to clean C, which may be integrated into existing projects or simulation frameworks.