Can I conditionally add an extension?

4 views
Skip to first unread message

wade.s...@gmail.com

unread,
Oct 14, 2021, 4:49:50 PM10/14/21
to netlogo-users
I want to use an extension locally that doesn't seem to be available on netlogo-web ( such as view2.5 or py ) but I'd like to write one piece of code that works in both places if I can.

I can hide all the other statements from the netlogo-web interpreter by putting double quotes around them and making them conditional "run mystatement" type lines.

But that doesn't work for hiding "extension [  py ]" or "extension  [ view2.5d ]" from netlogo-web so the code uploaded to the modeling commons won't run. The interpreter chokes.

Any ideas how to conditionally have an "extension [ xx] " type statement that is executed if the code is being run locally but hidden if the code is up in the Modeling Commons, using a test of netlogo-web? or something else?

Wade

John Chen

unread,
Oct 14, 2021, 8:41:12 PM10/14/21
to wade.s...@gmail.com, netlogo-users
Unfortunately, I don't think that's an existing feature. 

However, I am an advocate for conditional compilation (in NetLogo's case, maybe interpretation?), and I hope that could be possible in near future.

Theoretically speaking, it is possible for the NLW compiler to load extra extensions AFTER the model is first loaded. I also think it is possible for NetLogo Desktop. It is possible to design an extension to do that too. But the most elegant way is to support it at the compiler level.

I mean, we are looking at a third NetLogo implementation soon with some more unique extensions, and maybe we will face even more issues like this :)

wade.s...@gmail.com <wade.s...@gmail.com> 于2021年10月14日周四 下午3:49写道:
--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/01e6cb1b-7e37-4d91-a651-b7535160437en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages