ozra / onyx-lang

The Onyx Programming Language
Other
97 stars 5 forks source link

Taking a look at how to effectively further the project #103

Open ozra opened 7 years ago

ozra commented 7 years ago

Since time hasn't been on my side lately, and for some more months likely, I found the reason to take a hard look at the project as realistically as possible to see how it should best be furthered.

tl;dr: - search for "The Obvious Candidate" header further down.

Will quickly discuss some linguistic goals in consort with practical goals.

My primary original motivations in creating a new language were of:

Now, I need to take a hard look and re-focus how to realistically reach practical goals as of now. A plan has landed.

A primary practical take on Onyx dev...

So, naturally - to stick with a rational and realistic stiff upper lip attitude — it's obvious that prospecting a new "companion language universe" is imperative in order to reach intended goals with sane amounts of time invested. One that goes better together with Onyx; or the other way around more specifically.

Seeing as the origins of the project was a C-based parser ca '97, which then stalled, and then in the dark months of '99, out of _desperation of being freed from forced braces-syntax_ — I hacked together Cython (not to be confused with another proj a few years later with the same name...). With emphasis on "hacked". It was an just-get-it-done heuristic line-by-line ordeal in Perl.

And of course that just had to become part of my everyday code bases. There's a lesson (of cooooourse):

"Get shit done" gets more shit done than, err... not getting shit done!

You can quote me on that one! (Just don't use my name)

The code did suck, but it actually plain just worked! Completely transparently in my everyday coding! So...

Obviously this is a time to take a step back. Or 18 years. Well, ok, not really. The point is: C++ should be the "family" (it's not it, but its' syntax I've loathed). And two parallel development paths should be taken.

The Obvious Candidate

The arrived plan landed on a two development paths approach

Primary path: "Must be useable now!": Onyx-CX

Secondary path: Long term goal. Onyx-XL (yes! I actually think "X" sounds cool!)

Sod-Almighty commented 7 years ago

all available languages suck in one way or another

Damn straight. That's why I'm here.

Ruby and Lisp are AWESOME, but neither are suited for high-performance or static compilation. And C is a complete arse to use. Etc etc ad nauseum.

tl;dr

I dislike that term. Way I see it, if someone can't be arsed to read the damn thing, they should go home.

Be fully usable replacement for C++

Including static compilation with no dependencies.

I was overly optimistic that [Crystal] would be open to good suggestions

They do seem very resistant to new ideas. Which is one reason I no longer play in their yard.

C++ should be the "family" (it's not it, but its' syntax I've loathed)

Actually, with the advent of "C++1y" (closures, move semantics, etc), it's almost usable now. Get rid of those bastard header files, replace templates with generics, strongly type std::function, and allow monkeypatching of classes.... and C++ might yet crawl out of the dark ages and into the light of modern day!

I won't hold my breath though.

Statically linked self-contained musl based binaries

This!

You use the standard landscape of libs of the target (whether Lua, NodeJS-ES, web-ES or whatever) — just use a better language against them

There's a project called Haxe that targets multiple backends. I'd be satisfied with just C++, if it achieved my requirements of [a] zero-dependancy binaries, and [b] not being an utter bastard to use.

Anyhow....what I got out of your above post was essentially "drop the Crystal backend, and suddenly we start making progress at a sensible pace again". If so, I'm all for it. Hell, I'd be prepared to code a large part of the stdlib for you. Provided it wasn't in C.

I'm good at coding. I'm just not good at coding compilers. Give me a language that's nice to use - like Ruby - and I can code lots of stuff.

ozra commented 7 years ago

You sum it up well.

Funny you bring up Haxe, that's an example of what to avoid somwhat, they've made a rather elaborate stdlib-on-top to abstract to multiple systems. But when I think of it; I'm not opposed to it really. I'm confusing objectives here. I'm just not keen on spending time on one — since I myself would target a backend and play with its' libs and features specifically then.

The only onyx-core-stdlib parts will be the basic "always used types" which I think are good to abstract in a minimal-stdlib (Str, Int, ´32,U64, Byte, Map, Set, List, etc. etc.) and stdout/debug funcs (say, _dbg, etc.)

With "lenient" mode code-policy (default unless specific code-policy specified) any core-libs will be helpfully automatically included when definition from them are used (no fixed prelude like in Crystal I reckon)

Regarding C: I have no intention of making a C backend. Only C++. I would be fully open to include one provided whoever PR's that would take responsibility of maintaining it.

The few things (as I've imagined) in stdlib would mostly be mappings from ox-types to backend-types (well, obviously to no types for Lua and EcmaScript) and say, _dbg fn's.

Onyx will promote using strong numeric types with semantic meaning rather than intrinsic "hardware types":

-- Good:
op *(u Volt, i Ampere) -> Watt  -- ignoring AC vs DC for example
   Watt{ u.value * i.value }

power = 48V * 45A

-- Bad:
power = 48 * 45

It won't be forbidden or anything of course. Using non-coercing types will just be Onyx-culture idiomatic recommendation.

I must be clear on the fact that I'm still up to my brain-arse in shit to do — so this chosen path won't magically make development go rocket just yet I'm afraid. But it will not hurt (bar the initial re-write time...)

Sod-Almighty commented 7 years ago

48V * 45A

Yes, +1 for unit typing. Although explicit casts must be available; and the creation of a unit type should be as terse as possible.

I don't know what a brain-arse is, but I'm fairly sure I don't have one ;)

ozra commented 7 years ago
type MyNum < NumBuilder
   *, +, -, <=> MyNum, OtherAcceptableNumT, YetOne
   /, **, % MyNum  -- apparantly only wanted this with self here
   / YetOne  -- but div also accepts type YetOne

   init() -> here goes regular typedef code
   foo() -> and so on

That is:

I don't know what a brain-arse is, but I'm fairly sure I don't have one ;)

Consider yourself lucky! X-D

Sod-Almighty commented 7 years ago

Looking good. Always been a fan of unit types.

Is a brain-arse where brain-farts come out?