Skip to content
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

[Feature Request] ListLiteral should be subscriptable and implement __iter__ #319

Open
1 task done
xcloudplatform opened this issue Jun 4, 2023 · 3 comments
Open
1 task done
Labels
enhancement New feature or request mojo Issues that are related to mojo mojo-repo Tag all issues with this label mojo-stdlib Tag for issues related to standard library

Comments

@xcloudplatform
Copy link

Review Mojo's priorities

What is your request?

its really not good entry level experience if list literal is not subscribtable or iterable

What is your motivation for this change?

error: Expression [10]:45:27: 'ListLiteral[[!kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>]]' is not subscriptable, it does not implement the `__getitem__`/`__setitem__` methods





error: Expression [12]:44:25: 'ListLiteral[[!kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>, !kgen.declref<_"$StringLiteral"::_StringLiteral>]]' does not implement the '__iter__' method

Any other details?

x
@xcloudplatform xcloudplatform added the enhancement New feature or request label Jun 4, 2023
@Mogball Mogball changed the title [Feature Request] ListLiteral should be subscriptable and implement __iter__ method [Feature Request] ListLiteral should be subscriptable and implement __iter__ Jun 5, 2023
@Mogball
Copy link

Mogball commented Jun 5, 2023

We have to evolve our list representation a bit. [1, 2, 3] should be subscriptable but something like [1, "foo"] will be a bit trickier to handle.

@ematejska ematejska added the mojo Issues that are related to mojo label Sep 7, 2023
@octopushugger
Copy link

octopushugger commented Dec 6, 2023

I have this issue with DynamicVector[String] as well

regarding __iter__

@ltjkoomen
Copy link

Indeed, as of Mojo version 0.7.0:

  • __iter__ is still not implemented for DynamicVector[String]
  • __iter__ and __getitem__, __setitem__, __refitem__ are not implemented for ListLiteral

Related issues: #88, #89, now closed in favor of #100.

@ematejska ematejska added the mojo-repo Tag all issues with this label label Apr 29, 2024
@ematejska ematejska added the mojo-stdlib Tag for issues related to standard library label May 3, 2024 — with Linear
@ematejska ematejska removed the mojo-stdlib Tag for issues related to standard library label May 6, 2024
@ematejska ematejska added the mojo-stdlib Tag for issues related to standard library label May 6, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mojo Issues that are related to mojo mojo-repo Tag all issues with this label mojo-stdlib Tag for issues related to standard library
Projects
None yet
Development

No branches or pull requests

5 participants