
u/SwedishFindecanor

New newsletter from Commodore
A new newsletter from Commodore was sent recently. I wonder what this announcement might be about?
Does there exist an auto-ejecting SD-card slot?
I am trying to design a device with a reader for full-size SD cards that operates like a classic 3.5 inch floppy drive.
There already do exist spring-loaded push-push type connectors where tactile feedback from the insertion would mimic floppy insertion, and pressing the card again could mimic the sensation of pressing the drive's button for extraction.
However, SD cards are notorious for getting read/write errors from users ejecting them while an operation is in progress.
The ideal would therefore be if the ejection latch was under control by a microcontroller. (If you've ever used an Iomega Zip drive or a classic Mac then you'd know what I'm thinking about)
To eject a card, the user would have to press a microswitch which would cause the drive's MCU to ask the host to properly flush data, unmount the drive and confirm successful unmounting before the MCU pulses a solenoid that would release the latch. (Alternatively, that the solenoid would push the card out itself but that would require a larger solenoid)
Does such a full-size SD card connector exist? (My searches have been fruitless)
If not, could an existing SD-card connector be modified to work like this?
Does anyone know of a similar mod/project?
(A little unsure of which sub I should have posted this in. I'd think there is definite overlap. Searching forums online have not given much, because people have often confused "eject" with "unmount" and "push-eject" with "auto-eject")
The other day, I got a weird idea for a kind of memory management, especially for ordered data structures. I would like to know if there exists an older language that has done something similar before, and what the name and/or terminology of that was, so that I could search for more information about it.
The idea:
A data structure type definition consists of several class/struct/record type definitions. Some of these types have a set of state definitions, that declare the legal relations between objects through pointers. Each state definition consists of:
- Named entities including
this... butthisis optional! - The names of the entities' pointer fields.
- Which entity that each pointer field points to
A "method" to modify a data structure (append, prepend, reparent, etc..) consists of
- Mapping from parameters to entities and fields in state declarations (entity = param), and (entity = param.field).
- A state transition: i.e. named from-state and to-state. (The two states in a state transition would need to have matching entity names)
Together, the set of state definitions comprise constraints of which states the object could legally have.
Each "method"'s state-transition would be compiled into a serial list of instructions that moves pointers around — and allocates and frees this or other entities that are not part of the object.
This would be type-safe and memory-safe because all fields in the start-state must be either filled in the end-state or or its object be killed. And an object can not be killed if there could exist a pointer to it in any of the states in the set that has not been accounted for.
Example:
(This is just some pseudo-language invented in the moment)
List::Node<T> :: struct {
prev : ref Node<T>,
next : ref Node<T>,
data : ref T
attached :: state {
this.next = next, next.prev = this,
this.prev = prev, prev.next = this
}
detached :: state {
prev.next = next
next.prev = prev
// Note that `this` is not included, and therefore DEAD
}
insert :: method(before : ref Node<T>, data : ref T):ref Node<T> {
with {
next = before
prev = before.prev
} transition (detached => attached)
this.data = data
return this
}
remove ::method (this : ref Node<T>) {
transition (attached => detached)
// this is killed
}
}
This is just a loose idea at the moment, very incomplete. But I think that with some work it could be applied to trees, graphs, skip-lists, hash-tables, ... that are difficult to express in languages with unique ownership and borrowing without using an "unsafe" fallback.
I'm sure someone else must have created something very similar before, but used another terminology, possibly in some very esoteric language or field. What terms should I start searching for? Are there any papers that I should read?