-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some global smart constructors to domain
- Loading branch information
yuriy
committed
Apr 3, 2017
1 parent
cb5a62d
commit f9bd821
Showing
1 changed file
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the purpose of the
GLOBALS
table and its associated machinery inModuleLoad
. Why not just assignproc
s toDOMAIN
, etc. andexport
them? @JacquesCarettef9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really something that @yuriy0 should answer. This particular use seems like overkill. Other uses are 'clever' because it means that the update script does not need to be changed anytime new globals get added to Hakaru. I think the goal was to make reloading the library simpler, including making it actually work properly on Windows (which it never did unless you remembered to not have any active Maples when you did it).
f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what other uses (of what?) you have in mind. I'll remove this
GLOBALS
table for now. Thanks.f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure you don't break update-library, especially on Windows, when you do that. Thanks.
f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would it break update-library if I turn the
GLOBALS
table intoexport
ed assignments?f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at the new
ModuleLoad
code here and there, as well as the update-library. It uses thatGLOBALS
table directly, I believe.f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't know what you mean because I searched for the following regexps and didn't find anything:
f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at Hakaru.mpl and Domain.mpl.
thismodule
is manipulated in that way in both.f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you talking about the calls to
unassign
,WARNING
,protect
,unprotect
? I think I didn't disturb them...f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit adds some globals, such as
DConstrain
, that need to be assigned definitions, as @yuriy0 explains at 4d4b28f#commitcomment-22123094I think we should avoid globals that are assigned definitions. For globals whose names begin with
eval/
ordepends/
orprint/
, avoidance may be impossible. But for smart constructors such asDConstrain
, I believe avoidance is possible and preferable. I understand from @JacquesCarette that the way I turnedDConstrain
and friends into definitionsexport
ed from theDomain
module (cb91d54) may have madeupdate-archive
more difficult to use on Windows. However, I still have high hopes that this Windows difficulty can be eliminated, perhaps by moving theexport
ed definitions ofDConstrain
and friends into a separate module that does not depend onDomain
. I'm happy to try, but I need to be able to testupdate-archive
on Windows, so I have made a pending request for a demo ofupdate-archive
on Windows (cb91d54#commitcomment-21934956).f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
This isn't the case (at least on my Windows machine) - the change in question may cause some (minor) issues, but they shouldn't be platform related.
The only Windows-specific issue related to
update-archive
is the fact that while a Maple worksheet is running in which Hakaru was loaded, theppaml.mla
file is "locked". I don't know if you're familiar with this particular 'feature' of Windows, but it will not allow the file to be modified by any process other than the one which locked it (in this case, Maple). A consequence is thatFileTools:-Remove
will not work, because this is making a system call to some other process. However, the Maple archive tool can happily delete individual entries of an archive, which combined with the ability to list all entries in the archive gives a way to get an empty archive without deleting the file. At least on my machine, this will work even when the archive is open in Maple, presumably because there is a single Maple server process which owns the Windows file lock on the archive. This is currently how it's done inUpdateArchive
when the file itself cannot be deleted.The only issue with this change is that
uses Domain
has to be inserted in all the correct places; but that can't occur in submodules ofDomain
. This is not a platform issue, but a Maple issue, or an issue with how I've structured the Domain module and submodules.Perhaps coincidentally, the files inside of the
maple/Domain/Improve
directory aren't 'technically' submodules of Domain; in particular, usinguses Domain
is valid in these "submodules" of Domain and these only! And (certainly) coincidentally the places where cb91d54 addeduses Domain
are all insideDomain/Improve
and are the only places where it is needed.It is the change from global symbols to exported symbols which causes the need for
uses Domain
, so you should be able to test "moving the exported definitions of DConstrain and friends into a separate module that does not depend on Domain" regardless of anything which happens toupdate-archive
. I think this is a good idea; and something which we should do for all of our "global constructors", even those which are not assigned definitions, e.g.Bind, Weight, Ret, Msum, Plate, Context, Pair, _Unit, PARTITION
, all the primitive measures, all the Hakaru type constructors; that is, every global which is not one of the ones used as part of some Maple extension mechanism, likeprint/*
,depends/*
, etc.. I propose calling such a moduleHakaruGlobals
orHakaruGlobalSymbols
, and making it a package so one can writeuses HakaruGlobals;
.I'm not sure what a demo of
update-archive
would consist of - I've been using theMakefile
for a while now, and runningmake ppaml.mla
on my (Windows) machine succeeds by producing no output, regardless of whether the archive exists or not. RunningHakaru:-UpdateArchive();
in a worksheet also succeeds by producing no output; this requires that there already be a Hakaru archive.The only way to reliably test "success" or "failure" of this operation is to run all of the test cases; or at least a sufficient number of them to hit all the functions present in Hakaru. For example, if you were to somehow break the update of the Partition module, it would no longer be loaded, but tests which do not use Partition would still work. Perhaps we need a new test file consisting of test cases specifically chosen to hit all of the functionality (literally, as in all of the functions) of Hakaru, for testing that
update-archive
succeeded?Whether we are in 'bootstrap' or 'incremental' mode shouldn't matter - the same function is being run in either case. The only difference will be on Windows, when the archive already exists; but whether the archive file is deleted and a new empty archive is created, or the existing archive file is emptied to produce a new empty archive, should not make a difference. A potential way to test that the previous statement is actually true is to remove the logic which deletes the archive file, and just keep the logic which clobbers each entry in the archive individually.
f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the thorough reply. Are there some Action Items that still need to be done from this?
f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If github issues count, then #65 and #66.
f9bd821
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.