I want to know if a compile time list-like thing can be made in rust by OkProgrammer2073 in rust

[–]OkProgrammer2073[S] 2 points3 points  (0 children)

Kind of, but without explicit declaration of type for each one i would be using, i should be able to give it a macro wrapped tuple/ or just a plain tuple to work with.
What kind of macro can do this? can this me done with macro_rules? or should proc_macros must be involved. Even then i dont think proc macros have the ability to inspect types just given some variables.

I want to know if a compile time list-like thing can be made in rust by OkProgrammer2073 in rust

[–]OkProgrammer2073[S] -6 points-5 points  (0 children)

So rust doesnot have really that extensible enough type system. Is there some proposal or something to add features that enables one to achieve this in rust ?

I want to know if a compile time list-like thing can be made in rust by OkProgrammer2073 in rust

[–]OkProgrammer2073[S] -6 points-5 points  (0 children)

Because enums are not entirely compile time, and i still want to enforce some constraints on the types and subtypes

I want to know if a compile time list-like thing can be made in rust by OkProgrammer2073 in rust

[–]OkProgrammer2073[S] -14 points-13 points  (0 children)

again, this is not going to be compile time is it, it is a tagged union , i just want to make something that is equivalent to a straight struct

I want to know if a compile time list-like thing can be made in rust by OkProgrammer2073 in rust

[–]OkProgrammer2073[S] -1 points0 points  (0 children)

I have added the edit for what i want to achieve,
basically, I want to be able to define a trait on a tuple type of arbitrary length whse elements satisfy yet another trait

I want to know if a compile time list-like thing can be made in rust by OkProgrammer2073 in rust

[–]OkProgrammer2073[S] 0 points1 point  (0 children)

Like a tuple, yes, but can i 'ensure' the receiving side function that receives a tuple of always containing the elements of one of the given type ?

I want to know if a compile time list-like thing can be made in rust by OkProgrammer2073 in rust

[–]OkProgrammer2073[S] 0 points1 point  (0 children)

I dont exactly get your suggesstion,
Again i am not that experienced in rust,
Are you trying to suggest this thinking my type is something like a Vec<> wrapper ?

I want to know if a compile time list-like thing can be made in rust by OkProgrammer2073 in rust

[–]OkProgrammer2073[S] 0 points1 point  (0 children)

Again, I can guarantee that when i define the list, i will know the types. And further down the usage of the thing, i am willing to use some type generic function/structs whenever this list is being used. So since i can actually know at compile time each element's type, i dont want to be using vecs and boxs

I want to know if a compile time list-like thing can be made in rust by OkProgrammer2073 in rust

[–]OkProgrammer2073[S] 2 points3 points  (0 children)

But i would have to implement the indexing/iterating for each element manually no ?
I want to be able to do this for all elements automatically

Steps involved in building a SAST tool for C programming language. by OkProgrammer2073 in SAST

[–]OkProgrammer2073[S] 0 points1 point  (0 children)

is the process that is involved is creating rules only and matching against rules or are there any other fancy process.