Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Using labels as IDs #22

Description

@jpfairbanks

I was just browsing the code and I noticed this function:

labeledPetri[:tname][i] = tuple(Symbol(outputName),Symbol(""))

It looks like you are trying to ensure that the labels are unique in order to use them as primary keys somewhere. I think the better options are:

  1. Use the positional ID which is guaranteed to be unique. There is always exactly 1 "n-th state" or "n-th transition". This satisfies your need for primary keys. It is actually better than guaranteeing that the ID is unique. The parts(X, :A) are always contiguously indexed in 1:nparts(X,:A).
  2. You are storing a tuple where the last element of the tuple is Symbol(""), this is probably going to bite you later since you will have elements of a tuple that don't mean anything. It would be better to make the label (X, i) rather than (Xi, ""). In general it is bad to pack structured data like "a pair with a symbol then a number" into a string. You are much better off representing that as Tuple{String, Int}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions