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

Adding Function (Funda) for #170 #220

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from

Conversation

thecodacus
Copy link

@thecodacus thecodacus commented Mar 18, 2022

This PR closes issue #154 and Based on #170, this will be the first stage to make it more like a real programming language.

added Functional Programming features,

you can now create funda (functions) to make your code modularized, and not repeat yourself

example

hi bhai
apna funda test(c){
  bol bhai c;
  rakh le bhai "return bhi "+c;
}
bol bhai test("kam kiya bhai");
bye bhai

output

kam kiya bhai
return bhi kam kiya bhai

@netlify
Copy link

netlify bot commented Mar 18, 2022

Deploy Preview for bhailang-preview ready!

Name Link
🔨 Latest commit a2b0d83
🔍 Latest deploy log https://app.netlify.com/sites/bhailang-preview/deploys/63848e08619000000829e06f
😎 Deploy Preview https://deploy-preview-220--bhailang-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@thecodacus thecodacus changed the title Issue 170 Adding Function (Funda) Mar 18, 2022
@lgtm-com
Copy link

lgtm-com bot commented Mar 18, 2022

This pull request introduces 6 alerts when merging 74b5630 into fc11311 - view on LGTM.com

new alerts:

  • 2 for Illegal invocation
  • 2 for Unneeded defensive code
  • 1 for Useless conditional
  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Mar 18, 2022

This pull request introduces 4 alerts when merging 774d9c1 into fc11311 - view on LGTM.com

new alerts:

  • 2 for Unneeded defensive code
  • 1 for Useless conditional
  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Mar 18, 2022

This pull request introduces 3 alerts when merging fc93884 into fc11311 - view on LGTM.com

new alerts:

  • 2 for Unneeded defensive code
  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Mar 18, 2022

This pull request introduces 2 alerts when merging 0ffb32e into fc11311 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types
  • 1 for Unneeded defensive code

@thecodacus thecodacus changed the title Adding Function (Funda) Adding Function (Funda) for #170 Mar 18, 2022
@ankitchouhan1020
Copy link
Collaborator

Great work! will check.

@ankitchouhan1020
Copy link
Collaborator

hi bhai

apna funda Counter() { 
  bhai ye hai count = 1;
  
  apan funda increment() {
    count += 1;
    rakh le bhai count;
  }
  
  rakh le bhai increment;
}

bhai ye hai tick = Counter();
bol bhai tick();

bye bhai

Does it support closures ? Not working in preview.

@thecodacus
Copy link
Author

thecodacus commented Mar 18, 2022

hi bhai

apna funda Counter() { 
  bhai ye hai count = 1;
  
  apan funda increment() {
    count += 1;
    rakh le bhai count;
  }
  
  rakh le bhai increment;
}

bhai ye hai tick = Counter();
bol bhai tick();

bye bhai

Does it support closures ? Not working in preview.

you have a typo "apan" the keyword is "apna"
also I just fixed few bugs, it should be working now

image

@lgtm-com
Copy link

lgtm-com bot commented Mar 18, 2022

This pull request introduces 2 alerts when merging 3336243 into 0181ca4 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types
  • 1 for Unneeded defensive code

@lgtm-com
Copy link

lgtm-com bot commented Mar 18, 2022

This pull request introduces 2 alerts when merging 3dc5b92 into 0181ca4 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types
  • 1 for Unneeded defensive code

@tbhaxor
Copy link

tbhaxor commented Mar 19, 2022

Great work @thecodacus.

I will look into this. I was thinking to have duck typing in the functions. But this will also work

@tbhaxor
Copy link

tbhaxor commented Mar 19, 2022

Shouldnt we have it outside hi bhai? Like other languages? Hi bhai is the execution entry point

@shankarkrupa
Copy link

@ankitchouhan1020 @aniketsingh0104 or @ristri - could one of you review and approve the PR to be merged with the develop branch? This is such a cool and important feature. Eager to see this spreading against after playing around with this a bit in the netlify preview playground.

@aniketsingh0104
Copy link
Member

To be reviewed this week.

Copy link
Member

@aniketsingh0104 aniketsingh0104 left a comment

Choose a reason for hiding this comment

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

Critical: I see test cases are missing from this change specially from Parser. We won't review any PRs which do not contain proper test cases. Please write proper test cases covering positive and negative scenarios for both PARSER and INTERPRETER.

@aniketsingh0104
Copy link
Member

Complete Review would be only possible after the test cases are included.

@thecodacus
Copy link
Author

Complete Review would be only possible after the test cases are included.

Thanks for the review till now, I will make the changes and add test cases

@lgtm-com
Copy link

lgtm-com bot commented Jul 30, 2022

This pull request introduces 2 alerts when merging 567b961 into de68714 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types
  • 1 for Unneeded defensive code

@thecodacus
Copy link
Author

Critical: I see test cases are missing from this change specially from Parser. We won't review any PRs which do not contain proper test cases. Please write proper test cases covering positive and negative scenarios for both PARSER and INTERPRETER.

test cases added

@thecodacus
Copy link
Author

took me a while to get the time and make the changes :)
@aniketsingh0104 please check the changes

Copy link
Author

@thecodacus thecodacus left a comment

Choose a reason for hiding this comment

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

changes implemented

@lgtm-com
Copy link

lgtm-com bot commented Nov 28, 2022

This pull request introduces 2 alerts when merging a2b0d83 into de68714 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types
  • 1 for Unneeded defensive code

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. Please enable GitHub code scanning, which uses the same CodeQL engine ⚙️ that powers LGTM.com. For more information, please check out our post on the GitHub blog.

@Moulick
Copy link

Moulick commented Mar 21, 2023

Can this be merged, looks very useful bhai

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

Successfully merging this pull request may close these issues.

None yet

6 participants