typespec icon indicating copy to clipboard operation
typespec copied to clipboard

Operations allow me to specify an interface as a return type. Well. Kind of. Should they?

Open johanste opened this issue 3 years ago • 8 comments

Only the openapi emitter complains about operations returning interfaces. But otherwise it seem to compile just fine. Is that intentional?

Playground Link

johanste avatar Sep 12 '22 23:09 johanste

Think this is the same base problem as #561

timotheeguerin avatar Sep 12 '22 23:09 timotheeguerin

  • fix in the compiler

markcowl avatar Sep 19 '22 18:09 markcowl

pri: 1 est: 5

markcowl avatar Sep 19 '22 18:09 markcowl

@markcowl, questions on this.

  1. should the label be Required for DPG 2.0?
  2. Tim says it's the same problem as #561 but that is on the backlog. Just confirming this is something we want to do this sprint.
  3. Are we saying this is a bug (it's not labeled as such)? When you say "fix in compiler" do you mean that this should emit an error (warning?) when this happens?

tjprescott avatar Mar 24 '23 20:03 tjprescott

This is not required for DPG 2.0.

johanste avatar Mar 24 '23 20:03 johanste

This is not required for DPG 2.0.

Then is this really Pri 1 for this sprint?

tjprescott avatar Mar 24 '23 21:03 tjprescott

Yeah, the only reason this was marked as 'required' was in case it heralded a larger problem - if Timothee identified the problem, then this should no longer be required. I downgraded it in the sprint.

markcowl avatar Mar 24 '23 22:03 markcowl

I think typespec itself should allow this, to be able to model capability-based RPC like Cap’n Proto, and capnweb.dev. Each individual emitter should probably complain when they don’t support this pattern.

burdiyan avatar Nov 08 '25 22:11 burdiyan