Better types #15

Merged
alex-eg merged 27 commits from better-types into main 2025-10-30 16:05:44 +01:00
Showing only changes of commit d71bb97126 - Show all commits

View File

@@ -54,13 +54,13 @@ An example of Sex source:
#+begin_src scheme #+begin_src scheme
(include stdio.h) (include stdio.h)
(pub fn int main ((int argc) (char **argv)) (pub fn main ((argc int) (argv [* const char])) int
(puts "Hello from Sex!") (puts "Hello from Sex!")
(var (array char 512) name) (var name [char 512])
(puts "What is your name?") (puts "What is your name?")
(scanf "%s" (cast char* &name)) (scanf "%s" (cast (& name) (* char)))
(printf "Hello, %s!\n" name) (printf "Hello, %s!\n" name)
0) (return 0))
#+end_src #+end_src
Compile and run: Compile and run:
@@ -106,16 +106,16 @@ return Sex code.
(pub defmacro (list-T type) (pub defmacro (list-T type)
(let ((list-type (cat 'list- type))) (let ((list-type (cat 'list- type)))
`(struct ,list-type `(struct ,list-type
((,type value) ((value ,type)
((* ,list-type) next))))) (next (* ,list-type))))))
(list-T int) (list-T int)
#+end_src #+end_src
-> ->
#+begin_src scheme #+begin_src scheme
(struct list_int (struct list_int
((int value) ((value int)
((* list_int) next))) (next (* list_int))))
#+end_src #+end_src
**** Wrapper for checking return codes **** Wrapper for checking return codes
@@ -126,16 +126,16 @@ return Sex code.
(puts ,message) (puts ,message)
pkulev commented 2025-10-25 14:30:24 +02:00 (Migrated from github.com)
Review

Missing bracket one closing there is, senses of mine telling me, young Sexwalker.

Missing bracket one closing there is, senses of mine telling me, young Sexwalker.
pkulev commented 2025-10-25 15:12:16 +02:00 (Migrated from github.com)
Review
(pub fn init () int

And that doesn't look as valid C.

```suggestion (pub fn init () int ``` And that doesn't look as valid C.
alex-eg commented 2025-10-30 00:06:55 +01:00 (Migrated from github.com)
Review

😱

😱
alex-eg commented 2025-10-30 00:07:15 +01:00 (Migrated from github.com)
Review

😱

😱
alex-eg commented 2025-10-30 08:58:59 +01:00 (Migrated from github.com)
Review

🤯

🤯
alex-eg commented 2025-10-30 14:02:02 +01:00 (Migrated from github.com)
Review

There was not. You bamboozled me!
Screenshot 2025-10-30 at 16 01 22

There was _not_. You bamboozled me! <img width="343" height="94" alt="Screenshot 2025-10-30 at 16 01 22" src="https://github.com/user-attachments/assets/617c4c30-0462-40f8-9672-e2c23b51953c" />
pkulev commented 2025-10-30 15:15:53 +01:00 (Migrated from github.com)
Review

Why paren mathing is fucked up I guess, silly komputer haha

Seriously, look here mate
image

Why paren mathing is fucked up I guess, silly komputer haha Seriously, look here mate <img width="970" height="546" alt="image" src="https://github.com/user-attachments/assets/1738f71d-8357-47a7-b4eb-012400379d6f" />
alex-eg commented 2025-10-30 15:49:32 +01:00 (Migrated from github.com)
Review

🤤

:drooling_face:
(return ,ret-code)))) (return ,ret-code))))
(pub fn int init () (pub fn init () int
(check-sdl-return (check-sdl-return
(SDL-Init SDL-INIT-VIDEO) "Failed to initialize SDL" 1) (SDL-Init SDL-INIT-VIDEO) "Failed to initialize SDL" 1)
...) ...)
#+end_src #+end_src
-> ->
#+begin_src c #+begin_src c
(%fun int init () (pub fn init () init
(if (< 0 (SDL_Init SDL_INIT_VIDEO)) (if (< 0 (SDL_Init SDL_INIT_VIDEO))
(%begin (puts "Failed to initialize SDL") (return 1))) (begin (puts "Failed to initialize SDL") (return 1)))
...) ...)
} }
#+end_src #+end_src