guild icon
Toit
#Including generate files, adding to extension
Thread channel in help
addshore
addshore 05/28/2025 01:06 PM
So, i am generating files, and I was planning on calling them all foo.gen.toit
However seemingly can not be imported, due to the .
Next I tried calling them all goo_gen.toit
However this is also annoying as It leads to needing to import foo_gen which also would be nice to avoid.
Would it be possible to make everything after a . in a file actually be determined to be part of the file extension? And then also make toit allow / look for .*.toit and .toit?
bitphlipphar
bitphlipphar 05/28/2025 01:10 PM
You could use import foo_gen as foo as a workaround?
bitphlipphar
bitphlipphar 05/28/2025 01:12 PM
Would you have import foo look for all files of the form foo.toit or foo.*.toit and report an error if it is ambiguous?
bitphlipphar
bitphlipphar 05/28/2025 01:13 PM
Or would you use import foo.gen and just refer to it as foo in the code?
bitphlipphar
bitphlipphar 05/28/2025 01:13 PM
The latter seems a bit hard (it overlaps with looking into directories) and the former seems a bit iffy, but we already do some weird stuff to find files with - and _ in them.(edited)
bitphlipphar
bitphlipphar 05/28/2025 01:16 PM
8.3
addshore
addshore 05/28/2025 01:16 PM
so right now I have
import ..messages.messages_gen // Usage of something from that imported place Position.MT

Your point about ambiguity makes sense though
addshore
addshore 05/28/2025 01:17 PM
Yeah I think I have fallen over the - and stuff before too
I just tried having some files with both - and
in them and I dont think it was too happy about that
๐Ÿคฃ1
bitphlipphar
bitphlipphar 05/28/2025 01:17 PM
Discord formatting .... :๐Ÿ™‚:
addshore
addshore 05/28/2025 01:18 PM
maybe not .*.toit, perhaps a .gen.toit special case would be nice.
Really it would / could be nice then to have these combined into a single includable resource

foo.toit and foo.gen.toit in combination
addshore
addshore 05/28/2025 01:18 PM
but again, sounds messier than me just dealing with _gen for now :๐Ÿ˜›:
bitphlipphar
bitphlipphar 05/28/2025 01:20 PM
I think it is a super valid point and maybe settling on a way to deal with generated stuff is a good idea. For now, maybe _gen is the best. Have you considered not letting the users import the _gen files directly, but use an export in a non-generated file that then holds the weird import?
bitphlippharbitphlipphar
I think it is a super valid point and maybe settling on a way to deal with generated stuff is a good idea. For now, maybe _gen is the best. Have you considered not letting the us...
addshore
addshore 05/28/2025 01:21 PM
Yeah, perhaps I should tihnk about this for a second too.
This will be in a public repo so once I manage to get a working commit to solve my todays problem I'll think about it a little more and can link it etc :๐Ÿ™‚:
bitphlipphar
bitphlipphar 05/28/2025 01:21 PM
bitphlipphar
bitphlipphar 05/28/2025 01:21 PM
Let me know when we can take a look!
16 messages in total