Hi. Thanks for the explanations.

I don't feel strongly about this but for various reasons the Behaviour
Composer no longer uses NLS files and before today it included the support
NLS file (with unused procedures removed) at the end of the generated code
for the user's model. But this only partially worked since you can't have
two globals declarations. But I would have liked to have the beginning of
the file to have the important model code followed by necessary support
code which could have its own globals, etc.

I also worry a bit about existing models that won't load but in our project
we discourage links to the NetLogo code and instead to the Behaviour
Composer model that generates the NetLogo code.

Best,

-ken


On 29 January 2014 16:25, Seth Tisue <[email protected]> wrote:

> >>>>> "Ken" == Ken Kahn <[email protected]> writes:
>
>  Ken> P.S. Is this the right list to ask this or should I be using
>  Ken> github for this?
>
> Sorry, I know this can get confusing -- there's netlogo-users and
> netlogo-devel, plus we're now encouraging asking questions on Stack
> Overflow, and then there's all the repos at github.com/NetLogo, each
> with its own issue tracker.
>
> In general, unless you're fairly confident that it's more appropriate to
> use the issue tracker for something (e.g. if it's clearly a bug report),
> asking on a list first is a good default.  I think that's a safe
> statement to make about open-source projects generally, not just about
> us specifically.
>
> Mailing list threads can always later be linked to, or copy-and-pasted
> from, if an issue ultimately is created.
>
>  Ken> In 5.0.5 I can declare pens, globals, etc after some
>  Ken> procedures. In 5.1 M-2 'check' says 'keyword expected' and
>  Ken> highlights the word 'globals'. Moving it to the top fixes the
>  Ken> problem.
>
>  Ken> Is this an intentional change in 5.1?
>
> Ha, well, sort of.
>
> It may be accidental that this was *ever* allowed.  At the time, a
> decade or so ago, that we added support for including ".nls" files, we
> had to relax things so each included file could have its own
> declarations, separate from those in the main code tab.  This had the
> side effect of relaxing the restriction within each file as well.  I no
> longer recall if this was intentional or not.  Did we discuss it, did
> we notice and shrug our shoulders, or did we not even notice?  I can't
> remember.
>
> For 5.1, I did a ground-up rewrite of StructureParser, the phase of the
> NetLogo compiler that handles overall program structure.  (It needed
> redoing as part of preparatory work on Tortoise; plus in general, the
> old bad code was an obstacle for other potential compiler and engine
> improvements.)
>
> The rewrite involved replacing a bunch of messy ad-hoc parsing code with
> a formal grammar.  In case anyone's curious, the grammar rules are here:
>
> https://github.com/NetLogo/NetLogo/blob/headless/src/main/org/nlogo/parse/StructureCombinators.scala
> The pattern part of each rule is everything before `^^`.
>
> When I wrote the new grammar, I had to make an explicit decision about
> this issue of where declarations are allowed.  I picked the stricter
> option, figuring that it could always be relaxed later.  Also, my own
> feeling is that we probably don't want to encourage people to
> intermingle variable declarations and procedure declarations in large
> models.  We never do it that way in Sample Models.
>
> The decision isn't set in stone yet though.  The grammar could still
> be altered.  Do you want to make a pitch that it should be altered?
>
> --
> Seth Tisue | Northwestern University | http://tisue.net
> developer, NetLogo: http://ccl.northwestern.edu/netlogo/
>
> --
> You received this message because you are subscribed to the Google Groups
> "netlogo-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to