My initial report follows. But more immediately, I tried opening the mousetrap and distribution center models that use imported modules, and both crashed on my Apple Silicon macos, so maybe the problem I am seeing is more fundamental than me missing something.
Anyway, here’s the question I came with:
Keen to try out the new modules in 7.1.0. I made this model:
import list-utils as utils
to setup
clear-all
show utils:join-list range 10 ","
reset-ticks
end
Which imports this module called list-utils.nlm
export ["join-list"]
to-report join-list [#list #sep]
report reduce [ [a b] -> (word a #sep b) ] #list
end
It fails with Nothing named UTILS:JOIN-LIST has been defined.
Incidentally it took quite a few tries to figure out how to use exportnames which isn’t really adequately documented in the admittedly alpha release. It would also be helpful to note the need to use export in module files in the documentation for import because I was getting beachball of death crashes before I realised that, and while export references import the reverse is not true.
I also tried a procedure (not a reporter) in the module – although I am unsure how this would even work without being able to reference things in the main code – and that failed too.
I also tried without aliasing the module and that failed too.
@David_OSullivan I just tried the models you mentioned on my Apple Silicon laptop, and they worked as expected, as far as I can tell. Could you be more specific about what happened when you tried to run them, or provide any error messages that appear, either from NetLogo or the OS?
Thank you for this. I was sure I had tried that, but I think what I tried was
export (list join-list)
and that hung – as I’ve just reconfirmed it still does.
In short, the documentation of export really needs some care and attention, as it’s not even clear in its current state that you have to supply a bracketed list, and that it’s not actually a ‘list’ as such, it’s more like a globals or turtles-own statement syntactically.
Anyway, I think the issue with Mousetrap and Distribution Center models was clearly related to crash conditions on my simple test example. Once I got that working, the models in the library worked fine! There must have been something hanging around in the system state after it crashed on my test model that caused the library models to fail also.
However… one thing that seems common both to my test model, and to the library models, is when I try to open the imported .nlm file which is offered as an option in the Included Files drop-down list, I get an Internal Error (details pasted below). If such files aren’t viewable from the model (which would make sense so they don’t get edited willy-nilly) then they shouldn’t appear in the drop-down.
These teething problems aside, I am looking forward to making use of this huge enhancement to the language!
Here’s that error report (on macOS Tahoe 26.5.2)
NetLogo is unable to supply you with more details about this error. Please report the problem at https://github.com/NetLogo/NetLogo/issues or to [email protected] and paste the contents of this window into your report.
Please also include the steps necessary to reproduce the problem. If you need to attach a NetLogo model (i.e. .nlogox file), to ensure it gets through please put it and any accessory files in a zip file. If you cannot reproduce the error then please try to describe what you were doing when it happened.
We recommend that you use the latest version of NetLogo, which is available at https://www.netlogo.org/download
java.util.NoSuchElementException: key not found: time-series.nlm
at scala.collection.immutable.Map$Map1.apply(Map.scala:263)
at org.nlogo.app.codetab.IncludedFilesMenu$$anon$1.actionPerformed(IncludedFilesMenu.scala:66)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at java.desktop/javax.swing.AbstractButton.doClick(Unknown Source)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.desktop/java.awt.Component.processEvent(Unknown Source)
at java.desktop/java.awt.Container.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
NetLogo 7.1.0-alpha1
main: org.nlogo.app.AppFrame
thread: AWT-EventQueue-0
OpenJDK 64-Bit Server VM 21.0.2 (Oracle Corporation; 21.0.2+13-58)
Operating system: Mac OS X 26.5.2 (aarch64 processor)
Scala 3.7.0
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: Distribution Center Discrete Event Simulator
12:44:04.259 InterfaceGlobalEvent (org.nlogo.app.interfacetab.InterfacePanel$$anon$4 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
12:44:04.259 WidgetErrorEvent (org.nlogo.window.PlotWidget) AWT-EventQueue-0
12:44:04.259 WidgetErrorEvent (org.nlogo.window.PlotWidget) AWT-EventQueue-0
12:44:04.259 InterfaceGlobalEvent (org.nlogo.app.interfacetab.InterfacePanel$$anon$4 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
12:44:04.259 InterfaceGlobalEvent (org.nlogo.app.interfacetab.InterfacePanel$$anon$4 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
12:44:04.259 PeriodicUpdateEvent (org.nlogo.app.App$$anon$2 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
12:44:04.054 InterfaceGlobalEvent (org.nlogo.app.interfacetab.InterfacePanel$$anon$4 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
12:44:04.054 WidgetErrorEvent (org.nlogo.window.PlotWidget) AWT-EventQueue-0
12:44:04.054 WidgetErrorEvent (org.nlogo.window.PlotWidget) AWT-EventQueue-0
12:44:04.053 InterfaceGlobalEvent (org.nlogo.app.interfacetab.InterfacePanel$$anon$4 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
Thanks for sharing the error, we’ll take note of that for the next release. That’s definitely just a bug; you are supposed to be able to open and edit .nlm files in the app. Thank you for testing, and I’m glad to hear that you’re excited to try out the new functionality!
I got the same error message on a Windows machine, after a fresh start of NetLogo (7.1.0-alpha1) – exact same stack trace.
After opening the other example model, clicking the .nlm file from the dropdown list did nothing, but “Open Source File…” and then navigating to time-series.nl does work.
Then going back to the other example model, no crash, no other effect, and again opening explicitly does work.
(This seems not completely reproducible. Second time I get repeated error messages…)
About the documentation:
The description of import is adequate. An additional example linking a definition to its use (something like utils:add with parameters) might be useful.
However, the description of export is not enough to get started. For more information, it refers back to import.
Links in the announcement and release notes for more information about the import mechanism refer to the dictionary entry for import. I had hoped for a more extensive description of the mechanism, from export perspective as well as import perspective.
The included files dropdown bug is now fixed. We will definitely work on improving the documentation of the module system for the next release of 7.1, but for now, feel free to ask any specific questions here on the Forum.