public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
From: "Carlos Maniero" <carlos@maniero.me>
To: <ricardo_kagawa@disroot.org>, <~johnnyrichard/olang-devel@lists.sr.ht>
Subject: Re: [RFC SPEC] Primitive data types and arrays
Date: Thu, 18 Apr 2024 18:53:29 -0300	[thread overview]
Message-ID: <D0NKZ7DCTUI9.227U4AS27K31J@maniero.me> (raw)
In-Reply-To: <20240417013003.67442-1-ricardo_kagawa@disroot.org>

About arrays, Johnny has suggested to talk about arrays in a different
thread, I'm just waiting us to conclude this discussion and I'll start
another thread to define Olang's array specification. But we brought
excellent points, and maybe we should define pointers before arrays.

> Obviously, `boolean` can be either `true` or `false`, but what should
> that mean? If `boolean` is mapped to `u8`, then zero and non-zero?

IMO, true should be 1 and false 0 in a way that *1 == true* is true and
*2 == true* is false. Control flow structures may accept anything not
just booleans and may apply the non-zero approach you described, but we
can discuss this on their own RFC (that does not exists yet).

> But the real question is what would `char` be? If the language should
> support Unicode properly, then `char` would represent a _code unit_
> rather than a "character", which could be considered a misnomer. Since
> Unicode uses variable-length characters, a Unicode character might be
> difficult to represent as just `char`.
>
> If no Unicode support is planned, then `char` as `u8` is good enough to
> represent characters in 7-bit ASCII encoding.

I'll be honest with you, It makes a lot of sense all you said, making a
char a u8 seems to enforce an Western-Eurocentrism in Olang. But I
confess that I never stopped to learn more about unicode.

At the same time I think we should support a 32-bit sized unicode char,
I don't wanna make all chars an u32 keeping the support to ASCII encoding.

IMO, we should either postpone specifying a char right now or assume
that a char at this point represents an ASCII char and start a new RFC
about unicode where we may define something like an unicode char.

BTW, you seem well versed on the unicode theory, would you like to
purpose a mechanism to deal with unicode?

> Note that in most languages where there is a `void` type, the `void`
> type is not actually valid in variable declarations. [...]
>
> In the current version of the spec, it would be included in
> <return-type>, rather than <type>, to allow it only as a function
> return type.

Agree!

> Also, there are three other types that might be interesting, if I may
> suggest: `never` (from TypeScript [1]), `unit` (from functional-like
> languages [2]) and `null` (from ECMAScript specs [3]).
>
> [1]: https://www.typescriptlang.org/docs/handbook/2/functions.html#never
> [2]: https://en.wikipedia.org/wiki/Unit_type
> [3]: https://tc39.es/ecma262/multipage/overview.html#sec-null-value

They seems to be very specific, we may wanna to wait until we find an
use for them.

  reply	other threads:[~2024-04-18 21:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08  3:29 Carlos Maniero
2024-04-12  7:32 ` Johnny Richard
2024-04-13  2:51   ` Carlos Maniero
2024-04-13 23:31     ` Johnny Richard
2024-04-16  3:40       ` Carlos Maniero
2024-04-16 18:34         ` Johnny Richard
2024-04-17  1:30           ` ricardo_kagawa
2024-04-18 21:53             ` Carlos Maniero [this message]
2024-04-24 16:23               ` ricardo_kagawa
2024-04-20 11:45             ` Johnny Richard
2024-04-24 18:45               ` ricardo_kagawa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D0NKZ7DCTUI9.227U4AS27K31J@maniero.me \
    --to=carlos@maniero.me \
    --cc=ricardo_kagawa@disroot.org \
    --cc=~johnnyrichard/olang-devel@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.johnnyrichard.com/olang.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox