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

Define a schema standard for Mailbox Actor: Another Duck - Duckula #1

Closed
huan opened this issue Apr 8, 2022 · 2 comments
Closed

Define a schema standard for Mailbox Actor: Another Duck - Duckula #1

huan opened this issue Apr 8, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@huan
Copy link
Owner

huan commented Apr 8, 2022

Like the

Ducksify Extension

The Mailbox Actor also needs a standard for a best practice suggestion.

Draft

const Type = {
  GERROR: 'GERROR',
} as const

type Type = typeof Type[keyof typeof Type]

const Event = {
  GERROR: createAction(types.GERROR)(),
} as const

type Event = {
  [key in keyof typeof Event]: ReturnType<typeof Event[key]>
}

const State = {
  Idle: 'Idle',
} as const

type State = typeof State[keyof typeof State]

interface Context {}

const initialContext = (): Context => {
  const context: Context = {}
  return JSON.parse(JSON.stringify(context))
}

const NAME = 'FileBoxToTextMachine'

const machine = createMachine<Context, ReturnType<Event[keyof Event]>> ({
  id: NAME,
  initialState: State.Idle,
  on: {
    [Type.GERROR]: {
      entry: actions.send(Event.GERROR(new Error('demo'))),
    },
    '*': State.Idle,
  },
})

export {
  NAME,
  Type,
  Event,
  State,
  machine,
  type Context,
  initialContext,
}

Name it

We need a good name for this standard, maybe we can follow the Duck proposal and use XXX Duck as the name.

For example, Actor Duck, or Mailbox Duck?

Option 1: Duckula (see: Count Duckula)

image

source: Papercraft Count Duckula

@huan huan added the enhancement New feature or request label Apr 8, 2022
@huan huan changed the title Define a schema standard for Mailbox Actor: Another Duck Define a schema standard for Mailbox Actor: Another Duck - Duckula Apr 11, 2022
@huan
Copy link
Owner Author

huan commented Apr 11, 2022

Update

Today I found a project named also duckula and it is a similar concept to Clojure.

See: https://github.com/nomnom-insights/nomnom.duckula

Interesting! :D

huan added a commit that referenced this issue Apr 18, 2022
@huan
Copy link
Owner Author

huan commented Apr 18, 2022

The draft design has been implemented:

@huan huan closed this as completed Apr 18, 2022
huan added a commit that referenced this issue Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant