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

Refer core namespace to user namespace only when building slow version #351

Merged

Conversation

jcburley
Copy link
Contributor

This isn't needed for the fast version (forthcoming gen-code branch), nor by gen_data.go that I can see.

This isn't needed for the fast version (forthcoming `gen-code` branch), nor by `gen_data.go` that I can see.
@@ -690,8 +690,7 @@ func main() {
RT.GIL.Lock()
ProcessCoreData()

GLOBAL_ENV.FindNamespace(MakeSymbol("user")).ReferAll(GLOBAL_ENV.CoreNamespace)

GLOBAL_ENV.ReferCoreToUser()
Copy link
Owner

Choose a reason for hiding this comment

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

Won't this fail compilation with fast_init tag since ReferCoreToUser is not available with fast_init?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gen_code.go (which generates the fast_init stuff, so that doesn't actually work yet on master anyway) generates an empty ReferCoreToUser implementation into a_code.go. So this does work on the gen-code branch.

That's arguably a bit of a kludge, in that it could go into a proper *.go file compiled only with +build fast_init.

But right now there's not really any such "source" file in the ordinary sense, so I threw it into the generated a_code.go file.

Do you want it somewhere else? E.g. a core/fast_init.go file, with the "slow" version going into core/slow_init.go? They'd start out with just this one receiver in them, but might grow over time to include more stuff that isn't really specific to other existing files.

Or, we could put it in core/environment_fast_init.go and rename core/environment_init.go to core/environment_slow_init.go (and maybe the other core/*_init.go files accordingly, for consistency).

(As an aside, one of the things I absolutely adore about Go is the ability to do such simple renaming without having to edit Makefiles....)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Upon further consideration, I find I'm really liking the idea of all *_init.go files being either *_slow_init.go or *_fast_init.go.

I've updated my pending gen-code branch to put the empty implementation of this new receiver into core/environment_fast_init.go.

Then, unless I hear otherwise from you, I'll go forward with a (separate) renaming PR, that also adds the new source file from the gen-code branch.

But this current PR should be fine as-is, in the sense that it won't break anything.

Copy link
Owner

Choose a reason for hiding this comment

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

This makes sense, thanks!

@candid82 candid82 merged commit 4706c91 into candid82:master Feb 17, 2020
@jcburley jcburley deleted the refer-core-to-user-only-when-slow branch February 19, 2020 14:33
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