-
Notifications
You must be signed in to change notification settings - Fork 1
ilist dialect should use list
as a sugar
#277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We could do something like this:
from typing import TypeVar
from typing import Any
from kirin.dialects.ilist import IListRuntime
ElemT = TypeVar("ElemT")
N = TypeVar("N")
IList = IListRuntime[ElemT,N] | list[ElemT]
def myfoo(vars: IList[float, Any]):
return vars[0]
myfoo([1.,2.,3.]) # linter will be happy |
I thought @kaihsin was against having |
This approach user will annotate as the same as |
how do you construct an |
I think we should implicitly convert to IList implicitly, depending on the
methods' dialect group. If a given method has IList or list
…On Thu, Feb 20, 2025, 17:31 Xiu-zhe (Roger) Luo ***@***.***> wrote:
how do you construct an IList outside of the kernel tho? Or we are
accepting list and convert it into IList implicitly?
—
Reply to this email directly, view it on GitHub
<#277 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFCX3SKZTOMVN5O3GDRT56D2QZJSJAVCNFSM6AAAAABXPBI63GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZSHAZTOMZQGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: Roger-luo]*Roger-luo* left a comment (QuEraComputing/kirin#277)
<#277 (comment)>
how do you construct an IList outside of the kernel tho? Or we are
accepting list and convert it into IList implicitly?
—
Reply to this email directly, view it on GitHub
<#277 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFCX3SKZTOMVN5O3GDRT56D2QZJSJAVCNFSM6AAAAABXPBI63GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZSHAZTOMZQGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
how do you construct an IList then? always via Another question is if we are actually using This is now also in conflict with the explicitly annotated element type in an I feel supporting this as a syntax sugar is problematic in Python, we should just use the plain constructors instead of trying to support another syntax sugar - it's just not possible in Python. |
I think another way of doing it is just treat all |
currently we use
IList | list
in the statement wrappers to make linter happy, however, when working with larger codebase, one may declare a function as followinghowever, when calling this method using a syntax sugar
[..]
the linter will not be happy about it. I think there are two options here:
list
in type annotation but treat it asIList[T, Any]
list
syntax sugarcc: @kaihsin @weinbe58
The text was updated successfully, but these errors were encountered: