winglang / winglang/wing

consider adding `hashof` to immutables

Open
#238 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

📜 spec
Dominant language
TypeScript
Stars
5.4k
Forks
215
Avg merge
2h 9m
Merged PRs (30d)
27

Description

This came out of @Chriscbr 's recent cachebale function proposed example. Since Wing is heavy on immutables, compiler internally can efficiently generate unique hashes for all sorts of immutable objects. That way users can access this hash through something like hashof to do cache-keying. We need to implement this anyway internally for the compiler in order to be able to efficiently do equality checks between immutables, so might as well expose it to the user through a global hashof in the MVP spec to stay consistent with other xxxxof(...) globals. This would be equivalent to Java's Object.hashCode or similar mechanic in Python.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the compiler work needed for immutable hashing and equality, along with the MVP specification, using the cacheable-function example as context. Define the user-facing hashof behavior and verify that it supports cache-keying while remaining consistent with the compiler’s internal equality requirements.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.