public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
* [PATCH olang v2 0/2] docs: variables specification
@ 2024-04-08  4:38 Carlos Maniero
  2024-04-08  4:38 ` [PATCH olang v2 1/2] docs: spec: rename program to translation-unit Carlos Maniero
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Carlos Maniero @ 2024-04-08  4:38 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Carlos Maniero

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-10  6:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08  4:38 [PATCH olang v2 0/2] docs: variables specification Carlos Maniero
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

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