HNHacker News
TopNewBestAskShowJobs

andreabergia

364 karma · joined March 12, 2023

Currently working as Sr Staff SWE at ServiceNow, working on the JavaScript engine, and hacking on https://github.com/mozilla/rhino/

Blog: https://andreabergia.com Made in Italy

submissionscomments
andreabergia··on Show HN: A live Python REPL with an agentic LLM that edits and evaluates code
> So you could presumably also set it up to implement its suggestions (i.e. if it "executes" its proposed definition for `succ` that would actually just update it in the global namespace). Fun stuff.

Yep, I've had that working in some earlier version of the tooling.

> I'd suggest rethinking this; people usually expect the tab key to auto-complete.

That's a fair point.

> At any rate, thanks for writing the description yourself.

I might let an LLM write the code, and even the user's manual, but I write my own blog post and comments. :-)

andreabergia··on Ask HN: Share your personal website
https://andreabergia.com/ - my personal website and blog, which I'm currently redesigning!
andreabergia··on Turning 40
Thanks! That's really reassuring and will definitely help my nights! :-D
andreabergia··on The value of hitting the HN front page
I work at ServiceNow, which sells an enterprise platform and a ton of products built on top of it. Internal teams and customers can extend the platform by writing JavaScript, hence we have a JS runtime in the platform (the venerable https://github.com/mozilla/rhino/), which our team works on.
andreabergia··on The value of hitting the HN front page
Same here! I am now actually working in compilers, which is one thing I'm really passionate about, but not something I was doing professionaly. I managed to turn a toy project and some blog posts into an actual job at almost 40, so, thank you HN!
andreabergia··on Gremllm

  from gremllm import Gremllm

  # Be sure to tell your gremllm what sort of thing it is
  counter = Gremllm('counter')
  counter.value = 5
  counter.increment()
  print(counter.value)  # 6?
  print(counter.to_roman_numerals()) # VI?
I love this!
andreabergia··on Writing C++ in 2025
Of course I didn't assume to be 100% productive immediately, and I did spend a few weeks on this experiment, not just some days. My point was more about how even modern C++ felt (to me) dated and annoying to use compared to more modern language, because of the strong (but very valid!) focus on backward compatibility that C++ has. Furthermore, the long history and baggage means that for any thing, there are _many_ different ways of doing it, which doesn't help.

And anyway, it was not a particularly serious (or, for that matter, well written or argued) discussion. As I mentioned in literally the first line, it's just a rant :-)

PS: I am unsure what you mean with "relying on LLM for configuring things says it all". In my experience, this is one area where LLMs _really_ do help a lot - it has been much faster than going through the documentation (which I also did quite a bit of, in particular for conan).

andreabergia··on Emjay – a simple JIT that does math
Thanks!
andreabergia··on Ask HN: What benefits are important to you when choosing a job?
Remote is a requirement, due to family reasons. Salary.

Vacations, health insurance, parental leave are all given by law here (Italy). But, if they weren't, I guess they'd be pretty important.

andreabergia··on A JVM in Rust part 5 – Executing instructions
Good point. Someone (probably you) opened a GitHub issue about this too.

I might actually fix this one :-)

andreabergia··on A JVM in Rust part 5 – Executing instructions
That sounds reasonable (and way better than what I have implemented).

I am not sure I am going to try it though - it probably is a bit too much code to change for something that I consider "done" and I am not working on. :)

andreabergia··on A JVM in Rust part 5 – Executing instructions
Agreed, it _is_ annoying. It bubbles up everywhere and it feels like "something to silence the compiler" more than "something to express the safety of the code", as other people have pointed out.
andreabergia··on A JVM in Rust part 5 – Executing instructions
The problem arises by the fact that `Class` needs to refer to other classes:

    pub struct Class<'a> {
        pub superclass: Option<ClassRef<'a>>,
    }
    pub type ClassRef<'a> = &'a Class<'a>;
Given that classes are managed by the arena, I know the reference will not be dangling thanks to the 'a lifetime.

Initially I had implemented this with raw pointers, without lifetimes, but then I switched to the reference because it felt more "idiomatic" and I had to put the lifetimes just about everywhere to make the compiler happy.

If there are better ways to do this, I would be really happy to learn, though!

andreabergia··on A JVM in Rust part 5 – Executing instructions
Thanks, fixed!
andreabergia··on A JVM in Rust part 5 – Executing instructions
Well, I think it is written rather clearly in the first blog post of the series and in the github readme, whose second line is:

> Important note: this is a hobby project, built for fun and for learning purposes.

I am not going to repeat that in every part of the series. :-)

andreabergia··on VS Code as a dependency for an npm module
It is Visual Studio 2019, _not_ VS Code.
andreabergia··on I have written a JVM in Rust
I wanted to express the fact that everything that gets allocated (call stack, frames, classes, and objects) is alive and valid until the "root" VM is, thus I used 'a more or less everywhere.

I also struggled with a got a ton of errors from the borrow checker initially, and I fixed many of those with a lot of explicit lifetimes, but it's not impossible that in some places they are unnecessary.

andreabergia··on I have written a JVM in Rust
Well, _I_ feel impostor syndrome half the times I open HN honestly!

I did have a bit of experience with VMs before, I wrote many years ago a short series of posts about it on my blog, and at my previous job I dabbled a bit in JVM byte code to solve one very unusual problem we had for a customer. I also read the _amazing_ https://craftinginterpreters.com/ years ago and that gave me some ideas.

But this project was definitely big and complex. It took me a lot of time, and it got abandoned a couple of times, like many of my side projects. But I'm happy I finished it. :-)

andreabergia··on I have written a JVM in Rust
Indeed you are right, this is definitely a bug and could cause errors.

I guess the solution would be to add an explicit API to create a GC root, invoked by native methods (which is a bit complicated by the fact that I use a moving collector).

Many years ago I was using SpiderMonkey in a c++ project and I seem to remember there were some APIs for native callbacks to invoke that rooted values. Same problem and similar solution. :-)

andreabergia··on I have written a JVM in Rust
Thanks!

About the generics - some people have pointed out the same on reddit, and yeah, you are correct. The only thing that should be done is to read the Signature attribute that encodes the generic information about classes, methods, and fields (https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.ht...)

As a matter of fact, I just did a test and the following code works! :-)

    public class Generic {
        public static void main(String[] args) {
            List<String> strings = new ArrayList<String>(10);
            strings.add("hey");
            strings.add("hackernews");

            for (String s : strings) {
                tempPrint(s);
            }
        }

        private static native void tempPrint(String value);
    }
andreabergia··on I have written a JVM in Rust
Thanks!

I know the feeling - this project, like most of my other side projects, got abandoned a couple of times. But I was really curious about implementing a GC and, for once, I managed to finish something. I'm glad I did! :-)

andreabergia··on Ask HN: Could you share your personal blog here?
https://andreabergia.com

Blogging about programming languages and technology I find interesting... when I have the time and the energy for it, which sadly isn't that often.

andreabergia··on FF4J – Feature Flags for Java
We use it in production at lastminute.com and are pretty happy with it :-)
andreabergia··on Let's make sure GitHub doesn't become the only option
In my experience, SVN was _everywhere_ 10 years ago or so.
andreabergia··on Dropbox to reduce global workforce by about 16%, or 500 staff
> You'll also have some time TODAY AND TOMORROW to wrap up and say goodbye to colleagues.

As an European, I don't think I will ever get used to the fact that in the US people can be told "go home, you're fired" like that, effective immediately.

andreabergia··on Accenture would cut 19,000 jobs
They do every sort of consulting, including but not only development of custom software. For example, just from the largest Italian bank they make hundreds of millions of euro of revenues yearly.