#myta - A declarative language built for metadata definition and general-purpose configuration.
1 messages · Page 1 of 1 (latest)
cool project, generators are probably my favorite part of the syntax
yeah, I thought it's a cool idea to have regex generators, makes some stuff I was trying to do a lot easier :D
i can think of a lot of potential uses for it
Added syntax for pipelining multi-step operations:
https://codeberg.org/LmanTW/myta/src/branch/main/docs/sections/user/learn-myta.md#pipeline-expression
that syntax is super neat
now it reminds me a bit of the nix language with some new keywords
yeah some of inspirations came from nix
I didn't really like the syntax of Nix though
some of the keywords have pretty weird names
agree
also i dont like the fact that things like rec exist, they feel more like a cheap way to do things that you can just use a let binding for
and i think most people recommend not using rec anyways
im pretty sure Nix has a proposal to get a pipe operator which is neat tho
what is rec suppose to mean
recursive?
yes
you can like run an attribute set recursively if your doing like packages for example
and you have like 10 packages and you need 1 of those to be default
but its kinda useless since let exists and you can just define your packages in that and then it gets passed to the attribute set where you declare default
I used rec when writing a small helper function for parsing hex colors, it was just so I can have a context set which contains some state and functions (the functions need to access the states)
and I didn't want to use let to add another layer of indentation
I do hope at some point Nix people can figure out a way to make system rebuild way faster though
idk what the bottleneck is
but just imagine JIT for nix
ive thought of this before lol
nix jit would be awesome
nix is just very slow at evaluating tho, they didnt make it fast
this project has been under my radar for a while
its basically an alternative to the nix package manager
still compatible with nix but also designed to be faster + more modular so you can like plug it into programs as a library or something
interesting
man I really should make a FFI API for Myta
have some apps I wanna do and I don't think I'll write them in Zig
but writing FFI API is kinda a pain ðŸ˜
I'm thinking if I should add "shadow" type where it just reference to another table value but it can store some modification like extra fields, exclude fields, value modiofications etc...
so I can allocate less stuff
but it might use a lot more memory during execution depending on the use case (cause large table can't be freed because there's shadows of it)
I'm going to do a rewrite to remove recursive function calling in the parser and interpreter, and syntax to export and import so we can have a little module system, also going to make generators actual value that you can pass around
The parser is done, going to do some semantic analyzing, and then byte code gen
also changed the syntax of pipline to
|@| $std.string.split("1|2", "|") -> $[0]
|@name| 123 -> $std.string.split("1|2", "|") -> $name[0]
to tried making it more explicit to where the "$" (current value in the pipe) comes from
for now the |@| (capture) syntax kinda mean declaring a value that "changes" over the operation, so I also added it to the for loop to capture the current collection that's being transformed
for |@current| [void] * 10 with $index do (
if $index == 0 then 1 else @current[$index - 1] * 2
)
I guess you can argue that $index should also use the |@| syntax but I'm still thinking about it
mainly because currently the capture is a token so having multiple declarations is kinda hard
This is really cool!! I currently use CUE lang for schema/closedness and registry function but had glue in zig build, native would be amazing. Would myta, be able to declare invariant dependencies?
I don't really know what "invariant dependencies" means, can you elaborate on that?
By invariant dependencies, I mean semantic dependency edges like: begin_object depends on value_allowed, frame_capacity, push_object_frame, and top_is_object.
If i'm not mis-understanding it, Myta doesn't have any syntactic sugar for it. I think the closest you can get is to use a generator (function) to wrap the verifying logic in a reusable way. But note that Myta is designed so the language itself doesn't really have any syntax to enforce the type of the data, and the "schema" of the data is defined on the "application side".
the Zig API provides a Schema comptime utility which lets you convert a Myta runtime value to a native Zig value. You can do some simple validation with string length, integer value range, etc... but not really anything "dynamic"
The with syntax can now declare annotation, I was previous only supporting simple type like table or list, but man that's really not doing it, I think it needs to support something like list[integer] and table{ "key": integer }.
{
(@aGenerator) @anArgument: (
with $anArgument as void or string do void
)
}
The semantic analyzer should also be smart enough to figure out the type of $anArgument by looking into the body of the generator. The best case is when there's an annotative declaration, otherwise it'll need to guess based on the usage of the argument.
@empty notch appreciate the response.
yeah so I just tried parsing a 3.2MB JSON and it tooks myta 0.3s to parse it, kinda slow and all the time is spend on allocation and deallocation, idk how I can optimize it though
the main problem is that there's just a lot of hashmaps, maybe I can use an ArrayList backed KeyValue storage for smaller table, but idk if that will actually help with the performance all that much