What is the idiomatic way to undo a gensym?

I’ve never seen gensym before today, but is there an idiomatic way to undo the operation?

For example,

> gensym("Core.println")
Symbol("##Core.println#701")

I guess one way would be to regex it:

> match(r"(?<=##)[^#]*(?=#)", String(gensym("Core.println"))).match
"Core.println"

But that seems about as hacky as this question?

What problem are you trying to solve?

2 Likes

In JLD2, there’s a line that tries to make a convert call:

However, this seems to break for abstract types (at least when within an array).

On inspection, it shows that the object, x:

  • is of type JLD2.ReconstructedTypes.##Fussy.Reactor#739
  • and not of Fussy.Reactor

I was trying to do a diff on the fieldnames of the object stored in JLD2 and the current Fussy.Reactor

// if you could do this, then you might have a better chance of converting the object


edit: the T in the function is Fussy.AbstractReactor – which is abstract and therefore has no fields

Sounds like you want to prevent gensym from being called in the first place. (Macro hygiene error?)

3 Likes