Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.

Feature : Syntax : Add the final keyword to make a final variable initialization once #38

Merged
merged 4 commits into from
Sep 27, 2018

Conversation

Thecarisma
Copy link
Contributor

Description

Once a final variable has been assigned, it always contains the same value. If a final variable holds a reference to an object, then the state of the object may be changed by operations on the object, but the variable will always refer to the same object this make it non-transitivity. A final variable can only be assign to a value once through out the program.

Type Of Change

  • New feature: Non breaking change which adds a new functionality ( module, enviroment etc).

Briefly Explain Why This PR Should Be Merged.

Merging the PR will allow the final Keyword to be available throughout the simple-lang to make the lang a more safe and production safe programming language with less vices

How Has This Been Tested ?

Since this is a feature that is part of the language core and it also a syntax addition a final.sim syntax example has been added to the syntax example directory for a lead on how it works.

Also the Console module implements a lot of final variables e.g stdout, stderr, stdin e.t.c to make the variable value the same through out runtime for a more safer module

screenshot 90

Checklist:

  • I have created a supporting issue for this PR.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests passed locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Youngestdev
Copy link
Contributor

I'll review this.

Copy link
Contributor

@Youngestdev Youngestdev left a comment

Choose a reason for hiding this comment

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

Great, the final keyword works as expected.

@Youngestdev Youngestdev merged commit 5948e11 into theratioproject:master Sep 27, 2018
@Thecarisma Thecarisma added the enhancement New feature or request label Sep 27, 2018
@Thecarisma Thecarisma added this to the 1. milestone Sep 27, 2018
@Thecarisma Thecarisma modified the milestones: 0.3.0, 0.4.0 Oct 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants