Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified syntax of unit type enums and options #160

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

thelordgiveth
Copy link
Contributor

A small set of edits to syntax of enums and options exercises with empty 'unit type' ()

My personal solutions compiled with these small edits

I intend to also submit a PR to the Cairo Book to make the same readability changes for unit types in 6.1 'The option enum' and 6.2 'The Match Control Flow Construct'
Thank you for providing and maintaining this excellent resource

@shramee
Copy link
Owner

shramee commented Oct 18, 2023

Hi @thelordgiveth,
I feel this makes it a bit more confusing to do the exercise when you have to add args to your enum arm...

Copy link
Collaborator

@enitrat enitrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, totally makes sense!

@enitrat
Copy link
Collaborator

enitrat commented Oct 18, 2023

I feel this makes it a bit more confusing to do the exercise when you have to add args to your enum arm...

On the opposite I always thought it was confusing to force the use of the Unit type - which is only used when no meaningful value could be returned. Good coding practices force you into not associating a useless unit type to empty enum variants

@shramee
Copy link
Owner

shramee commented Oct 18, 2023

Totally agree. But in the removed unit types they have to add syntax themselves. Which is still fine.

@shramee shramee merged commit 00dfd01 into shramee:main Oct 18, 2023
1 check passed
@shramee
Copy link
Owner

shramee commented Oct 18, 2023

Thanks @thelordgiveth!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants