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

Syntactic ambiguity may need to be resolved #1

Open
jarble opened this issue Dec 8, 2015 · 3 comments
Open

Syntactic ambiguity may need to be resolved #1

jarble opened this issue Dec 8, 2015 · 3 comments

Comments

@jarble
Copy link
Collaborator

jarble commented Dec 8, 2015

In this sample code, I noticed that function parameters were not clearly distinguished from other parts of functions, causing some confusion:

To check if person is online on Skype:
    Skype.checkStatus(person) //Is 'Skype' a parameter of this function?
    if result is "online": return yes
    else return no
End

This code would be easier to read if the parameters were explicitly specified, like this:

To check if 'person' is online on Skype:
    Skype.checkStatus(person)
    if result is "online": return yes 
    else return no
End

This describes the program's intention much more clearly, ensuring that no parameters are created accidentally.

@pannous
Copy link
Owner

pannous commented Dec 8, 2015

Well this is an extreme example of a 'function', containing 'if' and 'is'.
It's more like a pattern to be matched. You are right that it would help to mark the 'loose' parts of the pattern.
However ideally the matching+marshalling engine should also match:
determine whether Peter is currently on Skype >> check if person is online on Skype
This would be the very long-term goal. For now:

Usually parameters are all 'nouns' in a function declaration:
to blubber some foo in bar: print foo

@pannous
Copy link
Owner

pannous commented Dec 8, 2015

To clarify: a variable/object matches a parameter, if it is of matching type:

to notify a person:
   send 'hi' to person

Peter is a person
notify Peter             // ok ... (if 'send' is defined somewhere ...)

foo is a bug
notify foo           // error/question: how to notify bugs? Is foo a person? Are bugs persons?

@pannous
Copy link
Owner

pannous commented Dec 8, 2015

To finally address your question: Skype is a singleton, so it's not really a parameter, only there for matching. Distinction between singletons / parameters : Upper case? Context? Quotes?

I'd say context.

Actually they don't need extra treatment:
Rule: If a parameter is missing but available in the context, take it.

So

to eat a meal: say 'yummy ' + meal
a hamburger is a meal
x=new hamburger
eat !        // x consumed  'yummy hamburger'

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

No branches or pull requests

2 participants