Open naturallymitchell opened 5 years ago
ya, still separate, but they're general src/ code, not handlers.
So just rename handlers
to src
?
no. handlers will be for any bindings that receive data continuously. they'll have a .rs and a .lua file in the handlers/ dir. debug.lua and bridge.lua are part of the whole crate. they don't fit in the handlers dir.
they'll have a .rs and a .lua file in the handlers/ dir
eg #139
What about renaming handlers
to lua
? still separated, and anyway the only "handler" is web_server, the rest is just misc lua code, and all lua code clearly separated from the rust code, less confusing than having to parse the extension in a directory supposed to be dedicated to rust code.
well afaict, there will be websockets, file sockets, streams, and more for handlers soon. I like a handlers
, especially after https://github.com/foundpatterns/torchbear/issues/139 , where they will have an interface.rs+lua for each of them.
why do you say src/ is "supposed to be dedicated to rust code"? I interpreted it as having base level components, in general, which is why it seems to fit.
I as a rust developer have not seen many projects with anything other than rust code in src, there are some cases, but it's rare, so it's better to clearly separate the rust code from anything non rust code, and having lua and rust files mixed around isn't as clear
yes, there could be handlers other than web-server and in that case it'd be useful to have a handlers directory, but I'm against moving lua files along with rust files, I like them separated. I'd suggest /src/handlers
for rust and /src/lua/handlers
for lua
debug and bridge aren't handlers
I know, I also said so a few comments above, the only handler there is web_server
For me, the most ive seen would be c and header files mixed with rust but havent seen people do that much recently since it makes more since to have such files separate but like Arnaz said it would be rare since you should have them separate from the code base anyway. If you want my opinion, it might be better to move any lua related code out of src
and maybe put them into a directory with a name based on their use other than having handlers
. They are being included into torchbear at compile time anyway.
In a nutshell, rename handlers
to lua, move handlers/webserver.lua
to lua/handlers/
and move bindings/web-server.rs
to src/handlers/web-server
I agree with moving them out of src as well
I'm thinking about scripts/
or environment/
, which would convey that they are the prepared environment, which might even be different than Lua in the future.
but moving them to src/
is about conveying the purpose of the crate, which is every much about what's in lib.rs as those "libs"
what about prelude/
?
I like scripts, it's the most obvious, environment and prelude are not very clear what they mean, I can't make sense of them either
seriously? prelude is a Romance language word. (so yea, make sense to change).. but it's what Haskell calls their grammar thing.
and it's a music term.. how is it really that senseless for you? even if you haven't used haskell
I'm not a native english speaker, i'm fluent at it but i'm not as familiar with the connotations of certain words, prelude is a term I don't use or see used often at all. Also, Haskell is not the best authority at names imo, wtf is a monad? or a functor?
In haskell, Prelude is the set of modules imported by the languge by default, If something in torchbear would be named prelude I think it would be the bindings, that's not what these lua scripts are about.
If something in torchbear would be named prelude I think it would be the bindings
great point.
I think we need a name for the programming environment so that we can name it's base/build/launch step. rlua is the environment that have already been "serenaded" by the bindings. the next step is to run it?
Well, all of that is a setup stage I guess. But what about the handlers? I still think the lua parts of the handlers should be separated from the rust part, and also that it makes a lot of sense to have all of lua parts close to each other (I'm talking about a directory dedicated to lua).
I believe, because the lua part is not as complicated, all of the lua files should be together with no further separation than being in different files with clear names (their current names are fine), except for the handlers maybe because there are actual plans to do more of them. In any case if the lua files do really get more complex, then moving files is not a difficult task.
src/setup/
seems good
except for the handlers maybe because there are actual plans to do more of them.
yes. once they grow, we'll add subdirs to handlers/
What about renaming
handlers
tolua
?
what about environments/lua
?
Any reason on why this should be done? It make sense to keep them separate imo