More duck typing and ambiguity

So I believe in WREC. We Wrote Enough Code.

I propose to introduce a “mode” to the language that allows gradually more ambiguity as more code is written.

Here is what I mean:

# entire code

It is easy to guess that the programmer meant there is an object obj_a and that it likely has set as it is the most commonly used type for the attribute my_collection, which existence is obvious.

The thesis is that this allows to write much less code to get same result, and with much more fun. Resolving the ambiguities is done by a combination of machine learning and automatic proof.

The idea of WREC is to go “all the way duck” to allow constructs (in the future) like

# entire code
a = create_canvas_in_a_browser()

I’ve been experimenting with this for a while and can say it can be done.

What do you think? Would you use this? Would you join the WREC project if one existed?

You mean like GitHub Copilot?

Not exactly. I mean yes, analyze code of other people,

but make a gradual change to the language instead of the generate-everything-at-one-shot

So the plan would be like:

  1. allow slightly more ambiguity, like inferring there is a “set” attribute probably initialized as empty from just the use pattern
  2. do some more ambiguity like auto-inferring metaclasses for the expected behavior that we derive from the code
  3. gradually get to the point that we can “infer” what a function means from its name and surrounding code

not the code-generation of copilot. It’s fun to write small code and not fun to debug large code, especially if it was generated

I have a pretty non-zero experience in proof, planning and meta to say it’s absolutely doable.

Okay, then I think you should probably write a small prototype implementation and publish a paper about it, right? Because with my limited understanding I have no idea how to do that, and I doubt you’ll get much help from the Python community (or its typing subcommunity) other than skepticism.


Sure. That’s exactly what I was thinking (and afraid) about.