Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make names declared as constants immutable#13

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
arsalan0c merged 4 commits intomasterfromprevent_constant_reassignments
Feb 21, 2020

Conversation

@arsalan0c
Copy link
Collaborator

@arsalan0carsalan0c commentedFeb 14, 2020
edited
Loading

add#12

This is done by storing an additional variable (is_variable) which indicates whether a name was declared as a variable. When assigning a value to a name, the value of this variable is then checked. If it is true, (eg. for names declared withlet), then the assignment is allowed. Otherwise, an error is thrown.

@arsalan0carsalan0c self-assigned thisFeb 14, 2020
@arsalan0carsalan0c added the enhancementNew feature or request labelFeb 14, 2020
@arsalan0c
Copy link
CollaboratorAuthor

arsalan0c commentedFeb 14, 2020
edited
Loading

We might need another way to automatically test this due to the inability to catch errors in Source

@anubh-v
Copy link
Owner

We might need another way to automatically test this due to the inability to catch errors in Source

We could add some data structure (at the global level) and use it to track errors. And then inspect it in the tests.

@arsalan0c
Copy link
CollaboratorAuthor

arsalan0c commentedFeb 17, 2020
edited
Loading

We might need another way to automatically test this due to the inability to catch errors in Source

We could add some data structure (at the global level) and use it to track errors. And then inspect it in the tests.

Could you clarify how we could use a data structure to track errors?
As my understanding is that when testing it in Source, the test program will abort due to an error.

For example, if the following is a test then an error will be thrown due to constant reassignment.

parse_and_eval("const x = 2; x = 4; x;");assert_equal(2,final_result);

@arsalan0carsalan0c merged commit81c8b83 intomasterFeb 21, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@anubh-vanubh-vanubh-v left review comments

Assignees

@arsalan0carsalan0c

Labels

enhancementNew feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@arsalan0c@anubh-v

[8]ページ先頭

©2009-2025 Movatter.jp