Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What led you to pick Ada? What was the development experience like?


Mostly I just like Ada, but there's a few things have been very useful here:

1. GCC has built-in dimensional analysis, which has saved me from errors that would have otherwise taken hours to track down or may have just gone unnoticed multiple times. As an example of this, there's a transcription error in the below code:

https://prunt3d.com/images/hn_dimensional_analysis_1.png

This line caused a compiler error that made it trivial to track down:

https://prunt3d.com/images/hn_dimensional_analysis_2.png

https://prunt3d.com/images/hn_dimensional_analysis_3.png

2. Intertask communication in Ada is nicer to work with than any other language I am familiar with, making it easy to make both the host and MCU software multithreaded: https://learn.adacore.com/courses/Ada_For_The_CPP_Java_Devel...

3. On the firmware side on things, Ada supports preemptive multitasking and exceptions with full tracebacks on small MCUs, which made firmware development much easier. Having preconditions that throw exceptions on procedures for controlling peripherals prevents a few hard to debug issues.

4. Someone already ported Adacore's embedded runtime to the MCU we use, so that was less work for me: https://github.com/JCGobbi/Nucleo-STM32G474RE

5. Ada supports defining the exact layout of types rather than having to rely on something like protobuf to get messages between the host and the MCU. I can just set the fields in these records and stream the bytes over a UART without any extra (de)serialisation: https://github.com/Prunt3D/prunt_board_2_software/blob/maste...


Right on. It's not something I see in the wild often, and it surely piqued my interested.


Thanks for this detailed information, this is very interesting!


I got this error for your PNGs:

> Access denied > The owner of this website (prunt3d.com) does not allow hotlinking to that resource (/images/hn_dimensional_analysis_2.png).


Oops, turns out hotlink protection is on by default. Fixed now.


What's your Emacs setup for Ada?


Eglot, Ada Language Server, and Ada mode from ELPA with the following config:

    (use-package ada-mode)
    (add-hook 'ada-mode-hook #'lsp! 'append)
    (setq-default ada-xref-backend 'eglot)
    (setq-default ada-diagnostics-backend 'eglot)
    (add-hook 'ada-mode-hook (lambda () (set (make-local-variable 'comment-start) "--  ")))

    (custom-set-variables
     '(ada-fill-comment-prefix #("--  " 0 2 (syntax-table (11))))
     '(wisi-size-threshold 2))
Then for each project I have a .dir-locals.el similar to the following:

    ((ada-mode . ((eglot-workspace-configuration . (:ada
                                                    (:projectFile "AAA.gpr")))
                  (tab-width . 3)
                  (fill-column . 119)
                  (indent-tabs-mode . nil))))




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: