public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
From: Carlos Maniero <carlos@maniero.me>
To: ~johnnyrichard/olang-devel@lists.sr.ht
Cc: Carlos Maniero <carlos@maniero.me>
Subject: [PATCH olang v2 0/2] docs: variables specification
Date: Mon,  8 Apr 2024 01:38:14 -0300	[thread overview]
Message-ID: <20240408043816.3781049-1-carlos@maniero.me> (raw)

This patchset specifies variables and constants.

Main changes in v2:
- Simplifications suggested by Johnny related to EOF
- Support all assign operators

There are two things a left outside this patchset:

1. The statement *const a += 2* is still valid at this spec.

I tried to fix it but it ends up too much complex. I'm not sure we need
to be so strict on the spec. The C spec does the same so I think  we are
fine.

2. Chained assignment

The statement *a = b = c* is not valid right now. We could discuss if
this is something that we really want to incorporate in the language.
The main reason are:

- It is hard to implement and it may mess with the great expression
  precedence algorithm we have right now.
- It brings complexity for the spec, the version we had at the previous
  discussion the statement *return = 2* was valid.

Fun fact that does not need to be considered:

- In gcc *a = b = 2* is slower then *a = 2*, *b = 2* once it actually
  makes *a = 2; b = a* requiring an extra instruction to copy the value
  from *a* at the stack to a register. But it is probably solved by
  enabling *-O3*

Do you think we can deal with chained assignment latter?

Carlos Maniero (2):
  docs: spec: rename program to translation-unit
  docs: spec: add variables and constants specification

 docs/pages/language-specification.md | 32 ++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 7 deletions(-)

-- 
2.34.1


             reply	other threads:[~2024-04-08  4:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08  4:38 Carlos Maniero [this message]
2024-04-08  4:38 ` [PATCH olang v2 1/2] docs: spec: rename program to translation-unit Carlos Maniero
2024-04-08  4:38 ` [PATCH olang v2 2/2] docs: spec: add variables and constants specification Carlos Maniero
2024-04-08  4:39   ` [olang/patches/.build.yml] build success builds.sr.ht
2024-04-08 11:35 ` [PATCH olang v2 0/2] docs: variables specification Carlos Maniero
2024-04-10  7:50 ` Johnny Richard

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=20240408043816.3781049-1-carlos@maniero.me \
    --to=carlos@maniero.me \
    --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