I noted that there is a new .wl file for scripts. There is some distinction between .wl and .m files? Should I change my current .m files into .wl?
The behavior of .wl vs .m has changed in V10.1 (and broke my code!).
When reading a Folder Package, now Wolfram reads first .wl instead of init.m inside Kernel directory, I have to change from .wl to the old .m to make my code works.
The documentation about Packages load order is deprecated, and has no mention to wl files or Kernel folder. Related post on SE.
The documentation about Packages load order is deprecated, and has no mention to wl files or Kernel folder. Interesting post on SE.
Now Wolfram reads first .wl instead of init.m inside kernel directory, I have to change from .wl to the old .m to make my code works.
For item number two in your list, the .wl file is not a notebook. It is in fact the .wl file itself. As such it is not a notebook, it is simply a text file with that file extension. So there are no cells and no notebook expression infrastructure in the background.
There is one place where you can't use a .m file. That is in the init.m file within the Kernel folder in an Application. An init.wl will not work whereas an init.m does work. That's the experience I have in 10.0.0 and 10.0.1.
Ok, thanks for the background. I would have thought though that it would have been more logical to simply load in the latest (.m or .wl) file?
At any rate
<So the developers at WRI (actually at my urging) changed the behavior for AutoGeneratedPackage -> True notebooks to default to saving with the .wl file extension.
The behaviour I observe:
Via the option inspector the only options on my set-up are:
AutoGeneratedPackage -> Automatic/Manual/None
1) For notebooks with AutoGeneratedPackage ->Automatic, initializations cells are saved into a .m file.
2) Files created via File>New>Package (and with subsequently added initialization cells) don't seem to produce any ancillary
(.m or .wl) files on saving?
I'm satisfied enough to proceed with 1) as before (I overload Needs to add flexibility to the Folder/File structure I can use to store packages) but it would be helpful if this was detailed in the documentation.
There was an issue with the design approach that was present in the prerelease version. The issue was that if a directory had two files, aContext.m and aContext.wl, both of which have code for loading the context aContext` by using Needs[...] (or Get) then Needs will choose to load the .m version over the .wl version. So, if one is developing a package from a notebook using Initialization cells and AutoGeneratedPackage -> True for that notebook then, if the notebook saved as a .wl file but still had a .m file version from development that took place during version 9, calling Needs on the context would always load the old .m file and not the updated .wl file. So the developers at WRI (actually at my urging) changed the behavior for AutoGeneratedPackage -> True notebooks to default to saving with the .wl file extension.
As far as I know the only difference between .m and .wl files is the suffix: otherwise they are the sam thing. Perhaps there will be a difference in the future...
If one chooses the File>New>Package menu command the resulting file, by default, has the .wl extension.
Related Question - How are .wl files created? Initialization cells seemed to produce .wl files in pre-release versions but in V10.0 they seemed to have reverted back to producing .m files?
Tks David. Nice to know.
They are the same. And if you have two files of the same name but only different from the extension in the same directory, I believe that Needs will read in the .wl file preferentially over the .m file.