Skip to content

strings option 5 - Use branded strings with extended prototype #7

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
option 5 vs 4 in preferred option
  • Loading branch information
joe-p committed Jun 16, 2024
commit 4bebd0aec64cf636901a0b039b34ac23005cc07f
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Option 4 would also require us to select an appropriate name for the type repres
- ✅ very obvious what it is
- ✅ obvious how it differs to `string`


Option 5 would be the preferred option if we were to prioritize developer experience whereas option 4 would be best if we priotized control over the prototype.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prioritize developer experience

This feels a little subjective. What aspects of the developer experience are prioritized by this option? The obvious one I can see is saving a couple of characters in declaration, but at the expense of having to explicitly type variables

const demo: bytes = "my bytes"
vs.
const demo = Str`my bytes`

someFunc("my bytes")
vs.
someFunc(Str`my bytes`)

Are there any others?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "a couple of characters in declaration" is a bit reductive of the impact it has on the developer experience. When developers use strings they expect to be able to put literals between quotation marks. Adding any friction to that can be a bit jarring. We saw this with PyTeal Bytes constructor frequently.

That being said, I agree that "developer experience" is too subjective, so I've changed it to familiarity


## Selected option

Expand Down