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

Fixes List Bug and Change the way list is printed in console #46

Merged
merged 6 commits into from Oct 28, 2018

Conversation

Thecarisma
Copy link
Contributor

@Thecarisma Thecarisma commented Oct 27, 2018

Description

This PR fixes some hidden and unresolved list error and include the addition and elevation of a new syntax in a for...loop to iterate over the list items rather than the index.

New Feature for..in

The new kind of for loop allows to iterate over the items in a list rather than the index e.g

list = ["one", "two", "three"]
for x in list {
    @x
}

Output :

one
two
three

it allows iterating over a list faster than using the index list[index] in a for loop

List printing

prior to this PR the list are printed into the console in an unordered manner which make it difficult to visually review the list. The following list is printed in below manner before and after this PR

list = [["a", "b", "c"], "ade", 2, 3, 4, 5, 6, 7, 8, 9]

Before :

a
b
c

ade
2
3
4
5
6
7
8
9


Now

[["a", "b", "c"], "ade", 2, 3, 4, 5, 6, 7, 8, 9]

Fixes issue #(issue-link )

Type Of Change

Please delete options that are not relevant and mark the ones that are relevant.

  • Bug Fix: Non breaking change which fixes an issue.
  • New feature: Non breaking change which adds a new functionality ( module, enviroment etc).
  • Breaking change - Fixes a feature that would cause existing functionality to not work as expected.
  • Documentation - Module or general documentation.

Briefly Explain Why This PR Should Be Merged.

How Has This Been Tested ?

Please describe how you ran the test after effecting your changes. Also, add snapshots or screenshots of the working change as proof-of-work.

This has been thouroughly tested with different kind of list, which include simple and stress test. The list demo example file has been updated to test the new features and fixes. Below is the screen shot of the output in terminal.
screenshot 182

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

Note

While building the compiler will generated a lot of error from the vmdll.c file as it contains some fresh and yet unmanaged code which will be moved out soon. the warning does not in any way affect the simple-lang

@Thecarisma Thecarisma added enhancement New feature or request module A new Module addition to the simple-lang standard library hacktoberfest Hacktober 2018 bug-fix labels Oct 27, 2018
@Thecarisma Thecarisma added this to the 0.4.0 milestone Oct 27, 2018
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.

If there's anything I've been waiting for, is this new style of displaying list values. Nice, we also have an improved for..in for looping lists... 🎉

@Youngestdev Youngestdev merged commit 2ba3e3f into theratioproject:master Oct 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request hacktoberfest Hacktober 2018 module A new Module addition to the simple-lang standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants