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

Allow global execution or not? #11

Closed
haasn opened this issue Nov 3, 2011 · 10 comments
Closed

Allow global execution or not? #11

haasn opened this issue Nov 3, 2011 · 10 comments

Comments

@haasn
Copy link
Owner

haasn commented Nov 3, 2011

Should we allow top-level expressions other than >implying or should we restrict it to those? The practical effect of this is, do we force everybody to create an OP function, or do we allow direct code execution?

The pros and cons of both:

Allow only top level implications, force OP functions:

Pros:

  • Functions can be declared in any order, the OP function can be at the top and helper functions at the bottom
  • The user can name the args variable to whatever he wants

Cons:

  • The user is always required to define an OP function, which is generally considered bad for interpreted languages

Allow top level execution

Pros:

  • No declaration overhead needed, simple scripts will be simple

Cons:

  • Functions must be defined before they are used, so all code must effectively be at the bottom of the file
@yate
Copy link

yate commented Nov 3, 2011

i'm for top level, for the pro listed (and easier to parse maybe?)

@graydude
Copy link
Collaborator

graydude commented Nov 3, 2011

This is quite a big thing. The real issue here is how the language is going to work; is it going to be compiled or interpreted?

@haasn
Copy link
Owner Author

haasn commented Nov 3, 2011

My implementation is definitely going to be interpreted, due to the runtime variable name resolution rules I've described. Of course, it could be compiled together with a very slow runtime (where every variable reference would perform a runtime call to resolve it)

@graydude
Copy link
Collaborator

graydude commented Nov 3, 2011

If we're going to go interpreted, I think we should allow global execution.

@haasn
Copy link
Owner Author

haasn commented Nov 3, 2011

It's probably the best solution. To solve the “functions need to be defined before they can be used” thing, a user could throw all of his functions into separate files and include them all at the top of the main file.

(We'd need a nice meme-based syntax for inclusion as well)

@graydude
Copy link
Collaborator

graydude commented Nov 3, 2011

How about

install functions.gs

We could have header files called gentoo!

I think we should also take a look at the name of functions. Maybe we can call them Threads or something. But I'll make another issue out of this some time.

@haasn
Copy link
Owner Author

haasn commented Nov 3, 2011

install sounds good. “install gentoo” should be reserved for something silly though, I don't know what yet.

I was thinking threads should be reserved for actual threads, eg. concurrency features that we may wish to implement later on.

Y'know, like /thread could mean “terminate the current thread” and all that. Maybe something else for functions, like “posts”?

@graydude
Copy link
Collaborator

graydude commented Nov 3, 2011

/thread sounds cool.
We could also use an unboxing thread for including, but install sounds better to me.

If we use posts for it, you know we should have a captcha for creating a new function :)

@haasn
Copy link
Owner Author

haasn commented Nov 3, 2011

Nah, but >captcha should be a built-in function which presents a captcha to the user (as popup if graphical environment is found, otherwise as ASCII art), and returns a bool depending on whether or not the user entered it correctly

@haasn
Copy link
Owner Author

haasn commented Nov 4, 2011

I'm closing this issue since it looks like we'll be keeping global execution.

@haasn haasn closed this as completed Nov 4, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants