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

Should use "file:foo" commands have guards? #39

Closed
andymcn opened this issue Sep 26, 2014 · 1 comment
Closed

Should use "file:foo" commands have guards? #39

andymcn opened this issue Sep 26, 2014 · 1 comment

Comments

@andymcn
Copy link
Contributor

andymcn commented Sep 26, 2014

Currently all use commands are allowed to have platform based guards. Should they be outlawed for package usage?

If we don't allow package guards then we can type check for all platforms on every build. However that can also lead to situations where people have to install packages specific to other platforms on their machines.

There are 3 basic options:

  1. Allow guards on package use commands (as now). No-one then ever needs to install any files for any other platforms, but we can't type check all platforms in one go.
  2. Outlaw guards for package use commands (very little work). We can then type check all platforms at once, but people may have to install packages for other platforms, that they will never use. This also leads to the problem that a bug in a package that you will never use can stop your program building.
  3. Something more complex. One possibility would be to allow guards on package uses, try to include the package regardless and not generate errors if a package with a failed condition does not exist.

Options 2 and 3 both also suffer from the potential problem of symbol clash. For example, given this:

  use "windows_foo" where windows
  use "linux_foo" where linux

If both the packages windows_foo and linux_foo define the symbol Bar then there will be a clash, even though the user probably won't expect one.

A further point is that if we allow cross OS compilation up to type checking (which should be easy) then checking another OS type checks OK is as easy as running:
ponyc src/ --pass=expr --target=windows

@sylvanc
Copy link
Contributor

sylvanc commented Oct 3, 2014

Option 1, for now. It's the most flexible, and the only cost is cross-platform type checking, and only if the programmer chooses to make that trade-off. We can revisit this later if we need to.

@sylvanc sylvanc closed this as completed Oct 3, 2014
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