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

Set example updated syntax #96

Merged

Conversation

kmarekspartz
Copy link
Contributor

This is a rebase of #30, and could be part of #86.

As mentioned near the end of #30, I should be adding tests and documentation. I'm not expecting this to be merged until then; I just wanted to get the syntax caught up.


contains(element) {
for (item in this) {
if (element == item) {
Copy link
Member

Choose a reason for hiding this comment

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

Style nit: how about making this a one-liner:

if (element == item) return true

I like omitting the {} for if (in both C and Wren) as long as the entire thing fits on one line and there's no else clause.

@munificent
Copy link
Member

Oh, yeah! I forgot all about this. I tend to go through periods where I cycle between side projects and I put Wren down for a while.

I like this example. Added a few comments. As you noted, some documentation and tests for contains will be good, but otherwise this looks rad.

Once we get maps in the language, I think that will imply more comprehensive support for hash codes. At that point, it will probably make sense to revise this. But until then, this is groovy.

@kmarekspartz kmarekspartz mentioned this pull request Jan 12, 2015
munificent added a commit that referenced this pull request Jan 12, 2015
@munificent munificent merged commit 650a70b into wren-lang:master Jan 12, 2015
@kmarekspartz
Copy link
Contributor Author

I see you merged this, but I was still working on it! I'll have a follow-up with some tweaks soon.

@munificent
Copy link
Member

Oops! Feel free to send me your tweaks. I was maybe a little overeager to get to zero open pull requests. :)

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.

None yet

2 participants