HN.zip

Blaise – A modern self-hosting zero-legacy Object Pascal compiler targeting QBE

52 points by peter_d_sherman - 17 comments
ausare [3 hidden]5 mins ago
“ The Object Pascal ecosystem has two options: Embarcadero Delphi (proprietary, Windows-first) and Free Pascal…”

This part isn’t true, for many years now we’ve also had Oxygene - https://www.remobjects.com/elements/oxygene/ (also proprietary)

pjmlp [3 hidden]5 mins ago
Which has had a strange relationship with Delphi, for a while they were responsible for Delphi.NET.
magicalhippo [3 hidden]5 mins ago
Looks interesting. As someone who's been using Pascal since Turbo Pascal 6, and use Delphi daily at work, I'm not sure I quite get the "COM-style interface GUID" objection. What exactly about it is complex, and how do you implement Supports() without it?
vintagedave [3 hidden]5 mins ago
Not the OP, but I can answer with an objection to COM-style GUIDs myself. Delphi's interfaces are heavily based around COM, and so you need GUIDs, ARC, etc.

But interfaces as a concept don't require the COM backend. If you want your code to be cleanly separated, but don't want to split ownership/management models* (create/free vs ARC), and have no need for an interface and type identity to be managed outside your code and process (ie no COM), then interfaces that are not tied to ARC, and not tied to COM, give the clean code benefit without the baggage.

[*] People work around this by implementing interfaces from a base class with no-op AddRef/Release methods. But this kinda shows the problem: why is that necessary?

I work with Oxygene which is another modern Pascal -- quite a few new Pascals have popped up recently, I get the sense there's a real desire for something new! Our interfaces can be 'clean' and we support soft interfaces, too.

magicalhippo [3 hidden]5 mins ago
But you don't need to specify a GUID for an interface in Delphi, and Blaise uses ARC for both objects and interfaces.
vintagedave [3 hidden]5 mins ago
True! But here at least Blaise is consistent. It’s not mixing models.

My real wish for Pascal interfaces is that they are pure. Some of that is not bringing in COM stuff (including recounting) because I think memory management is or should be different to interface-based clean coding. Another: In Delphi if you define a property in an interface, you have to bring in the getter and setter too. And that makes them implicitly public / visible (even if the implementing class declares them as private.) And they must be methods, there’s no way to say “read, but I don’t care how” (where Delphi can normally read fields too.) In other words, the semantic of “I want a property with read access” causes the interface contract to define the implementation, including making public the normally private / internal backing.

Whereas what I really want is to declare “property Foo: Integer read;” and the interface requires that is satisfied, but not how. In other words, interfaces are pure - they don’t bring in extra baggage. You can do that in Oxygene.

magicalhippo [3 hidden]5 mins ago
Being restricted to COM-style interfaces, so no true properties like you say, that I totally get.

However my question was mostly with the objection against having a GUID, and how Supports() is solved without said GUID, especially since Delphi interfaces doesn't require a GUID in the first place.

vintagedave [3 hidden]5 mins ago
I guess the language implementer needs to answer how they implement Supports :)

But within one app, ie not crossing boundaries, perhaps their object model's vtable carries references to the interfaces, so casting of any sort to/from object-interface and interface-to-interface would work, including Supports?

samuell [3 hidden]5 mins ago
It is a bit curious with the Mojo 1.0 beta coincidence, as Pascal was the other langauge with a highly readable and quite simple language combined with performant compiled code without GC.

What it lacked was a modern compiler and stack. There is FreePascal for sure, and Lazarus is impressive, but it for sure has its baggage.

vintagedave [3 hidden]5 mins ago
Yeah, Python and Pascal have always felt like they share similar vibes, despite being massively different languages. (Ease of writing, ease of reading, good inbuilts, etc.) Mojo feels like a clean take on similar goals... it's essentially a cleaner Python.
HexDecOctBin [3 hidden]5 mins ago
Does this support declaring variables anywhere (as opposed to only in the beginning of a function)? That was my primary complaint when using Lazarus.
pjmlp [3 hidden]5 mins ago
Delphi has allowed this for quite some time.
vintagedave [3 hidden]5 mins ago
Yes - OP, you can do this via inline vars and consts:

  begin
    var foo : string := 'hello';
    const c : integer = 5;
    var bar := GetBar(); // type inference even
    
    // and in blocks:
    for var i := low(x) to high(x) do...
  end;
tomekw [3 hidden]5 mins ago
That’s so great! Thank you!

I wish something like this existed for Ada :)

zx8080 [3 hidden]5 mins ago
Sorry, I don't trust a compiler project that's done in 3 weeks (I've checked the repo commits history). Downvote this if you want.
dvh [3 hidden]5 mins ago
For me the only reason to use pascal is GUI apps but this doesn't have it.
superdisk [3 hidden]5 mins ago
Looks cool and does aim to address some of the annoying warts in Pascal. Especially the memory model.