Skip to content

Improves the operation on iterators + various aspects of GAML - #699

Merged
lesquoyb merged 19 commits into
2024-06from
Iterators-improvement
Jun 12, 2025
Merged

Improves the operation on iterators + various aspects of GAML#699
lesquoyb merged 19 commits into
2024-06from
Iterators-improvement

Conversation

@AlexisDrogoul

Copy link
Copy Markdown
Member

Addresses primarily #677 by correctly retrieving and setting the value of the temp iterators's variables.

Correctly sets and retrieves the value of 'each' under different names
Deprecates the usage of the unnamed access to 'each'
@AlexisDrogoul
AlexisDrogoul requested review from Vezonne and lesquoyb June 5, 2025 01:25
AlexisDrogoul and others added 6 commits June 5, 2025 08:27
…trix_with and clean useless operator signatures
- Makes list_with, matrix_with iterators (which take as input the index, either an int or a point). The previous syntax (w/o using the iterator variable remains the same)
- Adds map_with (size, pair_expression) as an iterator with the int index as input.
@AlexisDrogoul AlexisDrogoul linked an issue Jun 5, 2025 that may be closed by this pull request
@AlexisDrogoul

Copy link
Copy Markdown
Member Author

This PR should fix and close #478 #677 #687

@AlexisDrogoul

Copy link
Copy Markdown
Member Author

Also working on closing #661

@AlexisDrogoul AlexisDrogoul linked an issue Jun 5, 2025 that may be closed by this pull request
@AlexisDrogoul AlexisDrogoul self-assigned this Jun 5, 2025
- removes 'my', 'the' as possible prefixes / '°' for the constants
- Fixes #666, allowing more complex expressions to follow '.'
- type_of returns the declared type (or runtime type in case of literal)
- actual_type_of always returns the runtime type
The sort / sort_by operator is prone to errors when the underlying container is modified during the sort. This fix makes sure we operate on a copy if this happens.
@RoiArthurB

Copy link
Copy Markdown
Contributor

The current compilation issue is the addition of org.eclipse.emf.mwe2.* in gaml.compiler/META-INF/MANIFEST.MF as Require-Bundle which can't be resolved by maven while compiling.

I tried to fix this without success, however removing this requirement fix the compilation and GAMA seems to work just fine. @AlexisDrogoul is it safe to remove it ? I'm not sure why you did explicitly add those packages there 🤔

- add `returns` as a facet of `do` (fixes #163)
- deprecates `with` as a facet of `do`
- correctly computes the type of actions and primitives used in `do`
- creates a specialized `DoDescription` to speed up compilation.
@AlexisDrogoul AlexisDrogoul changed the title Improves the operation on iterators Improves the operation on iterators + various aspects of GAML Jun 10, 2025
@AlexisDrogoul

Copy link
Copy Markdown
Member Author

The current compilation issue is the addition of org.eclipse.emf.mwe2.* in gaml.compiler/META-INF/MANIFEST.MF as Require-Bundle which can't be resolved by maven while compiling.

I tried to fix this without success, however removing this requirement fix the compilation and GAMA seems to work just fine. @AlexisDrogoul is it safe to remove it ? I'm not sure why you did explicitly add those packages there 🤔

Yes -- sorry. I left these packages because they are mandatory to compile the grammar, but forgot to remove them after.

Remove useless dependencies (which were breaking the compilation)
@lesquoyb

lesquoyb commented Jun 11, 2025

Copy link
Copy Markdown
Contributor

There are still some error at validation but nothing appears in the log in the gha (@RoiArthurB any idea why) ?
Anyway, on my computer I also have a crash at validate with this stack:

java.lang.ClassCastException: class gama.gaml.descriptions.StatementWithChildrenDescription cannot be cast to class gama.gaml.descriptions.DoDescription (gama.gaml.descriptions.StatementWithChildrenDescription and gama.gaml.descriptions.DoDescription are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @4cc61eb1)
	at gama.gaml.statements.DoStatement.<init>(DoStatement.java:207)
	at gaml.additions.core.GamlAdditions.lambda$66(GamlAdditions.java:175)
	at gama.gaml.descriptions.SymbolProto.create(SymbolProto.java:381)
	at gama.gaml.descriptions.SymbolDescription.compile(SymbolDescription.java:1449)
	at gama.gaml.descriptions.SymbolDescription.lambda$4(SymbolDescription.java:1468)
	at gama.gaml.descriptions.StatementWithChildrenDescription.visitChildren(StatementWithChildrenDescription.java:73)
	at gama.gaml.descriptions.SymbolDescription.compileChildren(SymbolDescription.java:1467)
	at gama.gaml.descriptions.SymbolDescription.compile(SymbolDescription.java:1454)
	at gama.gaml.descriptions.SymbolDescription.lambda$4(SymbolDescription.java:1468)
	at gama.gaml.descriptions.TypeDescription.visitChildren(TypeDescription.java:768)
	at gama.gaml.descriptions.SpeciesDescription.visitChildren(SpeciesDescription.java:1078)
	at gama.gaml.descriptions.SymbolDescription.compileChildren(SymbolDescription.java:1467)
	at gama.gaml.descriptions.SymbolDescription.compile(SymbolDescription.java:1454)
	at gama.gaml.descriptions.SymbolDescription.lambda$4(SymbolDescription.java:1468)
	at gama.core.util.IMap.forEachValue(IMap.java:656)
	at gama.gaml.descriptions.SpeciesDescription.visitChildren(SpeciesDescription.java:1080)
	at gama.gaml.descriptions.ModelDescription.visitChildren(ModelDescription.java:456)
	at gama.gaml.descriptions.SymbolDescription.compileChildren(SymbolDescription.java:1467)
	at gama.gaml.descriptions.SymbolDescription.compile(SymbolDescription.java:1454)
	at gaml.compiler.gaml.validation.GamlModelBuilder.compile(GamlModelBuilder.java:147)
	at gaml.compiler.gaml.validation.GamlModelBuilder.compile(GamlModelBuilder.java:90)
	at gama.headless.batch.ModelLibraryValidator.validate(ModelLibraryValidator.java:123)
	at gama.headless.batch.ModelLibraryValidator.lambda$0(ModelLibraryValidator.java:104)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at gama.headless.batch.ModelLibraryValidator.validatePluginsFromURLs(ModelLibraryValidator.java:104)
	at gama.headless.batch.ModelLibraryValidator.start(ModelLibraryValidator.java:55)
	at gama.headless.runtime.HeadlessApplication.start(HeadlessApplication.java:406)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:670)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:607)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1492)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1465)

@RoiArthurB

Copy link
Copy Markdown
Contributor

@lesquoyb Fixed with 26855cb

@lesquoyb
lesquoyb merged commit 76361c7 into 2024-06 Jun 12, 2025
@lesquoyb
lesquoyb deleted the Iterators-improvement branch June 30, 2025 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment