Author Topic: Ruby instead of Python? (for the PC side of MCU boards and lab tools)  (Read 7744 times)

0 Members and 1 Guest are viewing this topic.

Offline jfiresto

  • Super Contributor
  • ***
  • Posts: 1044
  • Country: de
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #50 on: July 26, 2025, 08:18:04 am »
Python is more like a slower but less verbose Java.
... Or a slower but less verbose C, or something like an interpreted Lisp with infix notation and no macros.

I think a big reason Python 2 caught on was that it is similar to and accepting enough of many different languages – enough so, that you could start by treating it as a dialect of languages you already knew and then gradually adopt succinct, characteristic Python. My early Python code could almost have been C without the semicolons and curly braces, in fact, such code is one way to write and test C.
« Last Edit: July 26, 2025, 08:33:04 am by jfiresto »
-John
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 5093
  • Country: gb
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #51 on: July 26, 2025, 11:44:14 am »
Python is problem #1 in Gentoo
When it breaks, and too often it does, everything collapses.

Also, being Gentoo/OpenRC based on python booting scripts ... Is toooooooooo slow on my PowerBook G3 (ppc750@400Mhz), and even slower on my japanese PDA (pxa270@400Mhz) and router (mip32r2@400Mhz)

Replaced with C stuff I wrote myself
5x faster on booting, 12x faster on emergency shutdown

The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline jfiresto

  • Super Contributor
  • ***
  • Posts: 1044
  • Country: de
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #52 on: July 26, 2025, 11:51:17 am »
Python is problem #1 in Gentoo
When it breaks, and too often it does, everything collapses....
Out of curiosity, what version(s) of Python?
-John
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17780
  • Country: fr
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #53 on: July 26, 2025, 02:19:23 pm »
Python is problem #1 in Gentoo
When it breaks, and too often it does, everything collapses.

Haven't looked at Gentoo in a longgg time, didn't know they used Python scripting for booting. Ouch.
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 5093
  • Country: gb
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #54 on: July 26, 2025, 02:49:51 pm »
Haven't looked at Gentoo in a longgg time, didn't know they used Python scripting for booting. Ouch.

They did! During the early OpenRC era (2005-2009).

Now OpenRC is fully written in C and POSIX-compliant shell, making it usable on BSD and Linux systems.
However, the core part of OpenRC was weak, it's the part that handles the dependency management and the init script parsing.
This stuff works by scanning the runlevels, building a dependency graph, then starting the needed service scripts.
So, for that stuff, Python was mainly used for as dependency solver at run-time, re-using part of the code already used for "emerge".

Dunno what next, at some point they introduced "runscript", then "openrc-run", and then "systemD" as option.
All things for which it was not always easy or possible to compile.
So I used the old system, before replacing it completely with my own stuff.
« Last Edit: July 26, 2025, 06:32:19 pm by DiTBho »
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 5093
  • Country: gb
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #55 on: July 26, 2025, 02:56:36 pm »
Python is problem #1 in Gentoo
When it breaks, and too often it does, everything collapses....
Out of curiosity, what version(s) of Python?

Between v2.6 and v3.1, included.
Lot of troubles on PPC, HPPA and MIPS.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17780
  • Country: fr
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #56 on: July 26, 2025, 03:03:34 pm »
Given that those scripts likely do not require the full and very rich ecosystem of Python and probably do just basic scripting, they should just have used Lua instead.

Lua is great, simple, veryyy fast, and I dare you to find a platform on which it doesn't build.
 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 5984
  • Country: gb
  • Doing electronics since the 1960s...
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #57 on: July 28, 2025, 07:44:42 pm »
Ruby seems dead now.

15+ years ago it was all the rage.

I "run" a few websites. One was written in Ruby on Rails, and by a real expert, and despite being attacked 10-100x per second, has not AFAIK been penetrated or damaged. But I cannot get anybody to do any work on it, below about £1500/day. Another is PHP because (after the Ruby dead-end experience) I specced it thus and there are no problems at all with it; it also withstands attacks just fine (the dev knew about SQL injection, XSS, etc). Both of these are fronted by Cloudflare for free https certs and in case of DOS attacks. Another is just HTML, gets attacked constantly but no penetration but it has no "language"; it is just HTML done in Dreamweaver, NGINX running on Centos, and also fronted by Cloudflare.

I think Ruby being such a dead end for server side work is not helped by the fact that most people working in that area get to hate their job by the time they get to about 40 ;) and are really keen to get out of it.
« Last Edit: July 28, 2025, 08:28:46 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5320
  • Country: nl
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #58 on: October 16, 2025, 06:36:17 am »
I understand and also share some of your sentiment towards Python, but in a different way. That python V2 had a weird print statement that did not follow normal function syntax was one of the many abominations, and that has luckily been fixed.

But python's whitespace formatting dependency is still one of it's biggest horrors. The way that python 3 was made incompatible with python V2 was also a 10 years lasting horror show. There were some ways that V2 libraries could be used with V3 but it was not implemented very well. Another thing that I don't like in python is that it just invents a new variable when you make a simple typo. Having to declare variables is a bit of a nuisance, but not detecting typo's in variable names is much worse. I dislike python for very similar reasons I never liked basic. Those are scripting languages designed to "quickly cobble things together" and not really meant nor suitable for bigger programs. MeldMerge is for example written in Python (and a quite nice program) but it suffers enormously from the slowness of python. When I was interested in Python I looked at the source of MeldMerge and even hunted down a bug. The bug was missing whitespace so one line of code was not included in a loop, but it was executed only once after the loop ended. Now try to  format a diff for that.

But despite that. python has become pretty much the standard scripting language, and it's "workable". It's used in KiCad, FreeCAD, Pulseview (slow protocol decoders). In comparison, I have not heard anything about Ruby in years. If you find it easy to learn a new language, and get to know all the libraries for that language, then you can use nearly anything. But if you want to limit the amount of programming languages you know and want to use, then using python for "all the scripting stuff" would be a logical choice.
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5320
  • Country: nl
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #59 on: October 16, 2025, 06:59:26 am »
It was a very long one even at x2 playback speed, from the creator of Ruby on Rails, David Heinemeier Hansson (aka DHH).  The pitch for Ruby caught my attention (between minute 41:53 and 45:10).  Maybe the next 10 minutes or so, too, where he gives some syntax examples

I managed to see a few minutes of that. He's grossly exaggerating C syntax "ugliness", and is also a proponent of "messy programming", because "humans are messy". I'm a messy human too, and I like a clear syntax such as using parenthesis for functions. Apart from a "print" I also saw a "puts" in an example. This triggers a memory on one of the other (and similar) horrors in python. I once was writing on a pretty generic class for some basic low level management, and it turned out that all the variable names I wanted to use were already interpreted by python as keywords.

From what I see, ruby and python are pretty much on the same level of ad-hoc messyness. In ruby you also don't have to declare variables.

When starting to program with python I wrote a simple loop to add things to a list. But the program did not work. It turns out that you can't add to an non existing list, so you have to declare an empty list before you start your loop. It's just one of the many inconsistencies in python.

When I was young, 35+ years ago, I disliked basic. The first program I bought was Turbo C++. I did have some difficulty with the syntax in the beginning, but I always (and still to) liked the straightforwardness of C syntax. Sure, C (and C++) has it's complexities hornets nests and dragons too, but I find those more understandable and comprehensible. Maybe that is partly because I learned those languages when I was still young, but back then I disliked basic too.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 6407
  • Country: nz
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #60 on: October 16, 2025, 07:02:27 am »
Another thing that I don't like in python is that it just invents a new variable when you make a simple typo. Having to declare variables is a bit of a nuisance, but not detecting typo's in variable names is much worse. I dislike python for very similar reasons I never liked basic. Those are scripting languages designed to "quickly cobble things together" and not really meant nor suitable for bigger programs. MeldMerge is for example written in Python (and a quite nice program) but it suffers enormously from the slowness of python. When I was interested in Python I looked at the source of MeldMerge and even hunted down a bug. The bug was missing whitespace so one line of code was not included in a loop, but it was executed only once after the loop ended. Now try to  format a diff for that.

Believe it or not, but JavaScript avoids all the problems you mention, if you put "use strict" at the start of the program.

- it won't let you assign to an undeclared variable. (None of these languages let you *use* an undefined variable, unlike Perl, which needs "use strict" even for that)

- uses a C/Java-like syntax, not whitespace dependent

- has as huge a library of modules as Python

- in modern nodejs runs at a similar speed to Java / C# or C++ with -O0, much much faster than Python
 

Offline Picuino

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: es
    • Picuino
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #61 on: October 16, 2025, 07:51:05 am »
One of the major problems I encounter in this type of PC application is creating a graphical interface that is easy to program. The old VisualBasic or Delphi/Pascal were very good at that. Python and Ruby do not have simple tools for creating graphical interfaces.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 6407
  • Country: nz
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #62 on: October 16, 2025, 08:15:41 am »
One of the major problems I encounter in this type of PC application is creating a graphical interface that is easy to program. The old VisualBasic or Delphi/Pascal were very good at that. Python and Ruby do not have simple tools for creating graphical interfaces.

Funnily enough, JavaScript has a shit ton of libraries for that, if you have a web browser. (And all modern OSes allow you to embed an HTML pane inside an app window)
 

Offline Picuino

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: es
    • Picuino
Re: Ruby instead of Python? (for the PC side of MCU boards and lab tools)
« Reply #63 on: October 17, 2025, 11:05:56 am »
JavaScript has many libraries and frameworks for creating GUIs. Which one do you recommend for interacting with microcontrollers? It should be easy to use and powerful enough to create graphs or lists with the microcontroller's output data.

Edit: Alpine.js and Chart.js together to provide full functionality?
« Last Edit: October 17, 2025, 11:10:59 am by Picuino »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf