Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 4
    It sounds like you may be after something like TypeScript's structural typing? - typescriptlang.org/docs/handbook/type-compatibility.html Commented Dec 15, 2022 at 0:11
  • As a note, in duck typed languages a variable's type is generally immutable. The construct you're describing where symbols can be rebound, so 'var1 = 1; var1 = 'hello';' will work, is also found in static languages like Rust and C++ and is a quite different idea. Commented Dec 19, 2022 at 22:50
  • ^I meant object where I said variable here, and my use of the word symbol is confusing XD but other than that the point stands, redefining things does not a dynamic language make (and if that was the only difference then yes you could make it static - see rust). Commented Dec 19, 2022 at 22:59