@brianwi...@google.com @sraw...@google.com This is a rough draft of adding a function signature to the `TargetKind`. This could be of use for cases like https://github.com/GoogleCloudPlatform/functions-framework-dart/blob/8083517599d7f2fb58123776a88f029f094cb5e0/functions_framework/lib/src/cloud_function.dart#L22, where we know the target must have a certain signature (in that case accepting an `HttpRequest`), but have no good way of expressing that so far in our type system or through language features.
What do you think?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
@brianwi...@google.com @sraw...@google.com This is a rough draft of adding a function signature to the `TargetKind`. This could be of use for cases like https://github.com/GoogleCloudPlatform/functions-framework-dart/blob/8083517599d7f2fb58123776a88f029f094cb5e0/functions_framework/lib/src/cloud_function.dart#L22, where we know the target must have a certain signature (in that case accepting an `HttpRequest`), but have no good way of expressing that so far in our type system or through language features.
What do you think?
Hey Moritz, sorry for the delay!
Brian and I generally like this idea. But we need to know the specific motivation here, to judge the implementation a little better. Would you mind filing an issue?
class FunctionTargetKindInternal {Can you explain this a bit more? The fact that `get targetKinds` returns `Set<Object>` makes me squirmy. I see how we need to fill this with `signature: signature.toTypeValue() as FunctionType` which is not available directly on the constant object. But maybe we can still subclass `TargetKind`?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Samuel Rawlins@brianwi...@google.com @sraw...@google.com This is a rough draft of adding a function signature to the `TargetKind`. This could be of use for cases like https://github.com/GoogleCloudPlatform/functions-framework-dart/blob/8083517599d7f2fb58123776a88f029f094cb5e0/functions_framework/lib/src/cloud_function.dart#L22, where we know the target must have a certain signature (in that case accepting an `HttpRequest`), but have no good way of expressing that so far in our type system or through language features.
What do you think?
Hey Moritz, sorry for the delay!
Brian and I generally like this idea. But we need to know the specific motivation here, to judge the implementation a little better. Would you mind filing an issue?
I filed https://github.com/dart-lang/sdk/issues/61275 with the comment above a bit elaborated.
class FunctionTargetKindInternal {Can you explain this a bit more? The fact that `get targetKinds` returns `Set<Object>` makes me squirmy. I see how we need to fill this with `signature: signature.toTypeValue() as FunctionType` which is not available directly on the constant object. But maybe we can still subclass `TargetKind`?
Yes, this CL is not at all ready yet, this is just an idea.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
class FunctionTargetKind extends TargetKind {Could make it
```dart
class FunctionTargetKind<F extends Function> extends TargetKind {...}
```
instead to ensure that the type is actually a *function* type.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |