Message Boards Message Boards

2
|
17965 Views
|
10 Replies
|
7 Total Likes
View groups...
Share
Share this post:

.m VS .wl file. There is difference? (in V10.1 yes..)

Posted 11 years ago

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?

POSTED BY: Rodrigo Murta
10 Replies

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.

POSTED BY: Rodrigo Murta

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. Interesting post on SE.

POSTED BY: Rodrigo Murta

The behavior of .wl vs .m has changed in V10.1 (and broke my code!).

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. Interesting post on SE.

POSTED BY: Rodrigo Murta

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.

POSTED BY: David Reiss

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.

Posted 11 years ago

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.

POSTED BY: Ron Monson

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.

POSTED BY: David Reiss
Posted 11 years ago

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?

POSTED BY: Ron Monson

Tks David. Nice to know.

POSTED BY: Rodrigo Murta

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.

POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract