Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples on data classes. remap-data. Extending accessor-data. #36

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

bmiww
Copy link
Contributor

@bmiww bmiww commented Dec 12, 2023

Hey!

Dropping here some musings i've had while exploring the alloy data classes.
Since the existing examples helped me get going - thought i'd write my own for the data classes while i was playing around with them.
It's not a complete example on all the possible data classes - but it covers some of the points of interest i had.
Namely - several of the data classes that inherit from object-data.

Which also got me going on playing around with the implementations of some of the data classes.
The FEAT commits are as follows:

  • accessor-data: I rather liked the idea of derived observations - where an accessor observation would be notified also when the slot connected to the accessor changes.
  • remap-data: Making some assumptions about the intended use here - but i assume this is meant as an object which proxies slots to a base object. Therefore - I've fixed the observe invocations and extended the access methods to consider mapping declarations.
  • remap-data setf slot-value: This one i'm not fully sure of. It covers the case when a slot on the remap-data object would be changed directly - if its a mapped slot - similar behaviour to how access methods are handled.

While writing the example - it irred me that whenever i would change the base object values directly - the observers of accessor-data or remap-data wouldn't fire - which ended up being my motivation for all this.

@bmiww
Copy link
Contributor Author

bmiww commented Dec 12, 2023

Did some more playing around with the remap-data stuff - it's a bit uncomfortable to work with cross-package.
Still interested if the direction was as intended. If not - i can still keep it around locally in my own project.

@Shinmera
Copy link
Member

Heya, cool to see you're working with Alloy!

I'm far too tired to review this tonight but I'll take a proper look tomorrow. The only thing I saw on the quick is the enter+ thing which I'm not sure why it's needed when enter-all exists (or why it's a macro).

For some of these data things it's very well possible that I won't even remember how they were supposed to work or were half-abandoned prototypes.

@bmiww
Copy link
Contributor Author

bmiww commented Dec 12, 2023

Yeah, no worries, the remap-data was broken as is - so no high stakes there.

I've still got some ideas that i might explore in the direction of data handling.
For example the mapping argument in remap-data seems a bit clunky to use.

Also - after creating the pull request - i started playing around with remap-data in my project thing,
And something still feels a bit iffy when closer to real classes.

Thanks for the enter-all mention. No point in enter+ being a macro, or existing at all.
(relatively new to common-lisp - and been a while since i've used macros - so i'm macro power-hungry)

@Shinmera
Copy link
Member

Sorry for the delay on the review. I forgot about it again and then had some personal issues that interfered.

Anyway, hope you've been having a good holiday season!

@bmiww
Copy link
Contributor Author

bmiww commented Dec 29, 2023

As with any holiday - heavy ups and downs.
Switched focuses during holiday, probably going to return to codey stuff come new year.

Have to figure out something for my fancy symbol mode for emacs. Looks like I'm producing off by one spacing on lines following ifs due to if being just one symbol "visually" on my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants