jazzdotdev / jazz

The Scripting Engine that Combines Speed, Safety, and Simplicity
Apache License 2.0
147 stars 11 forks source link

move bridge.lua, debug.lua, and bootstrap.lua from handlers/ to setup/ #132

Open naturallymitchell opened 5 years ago

dariusc93 commented 5 years ago

Any reason on why this should be done? It make sense to keep them separate imo

naturallymitchell commented 5 years ago

ya, still separate, but they're general src/ code, not handlers.

dariusc93 commented 5 years ago

So just rename handlers to src?

naturallymitchell commented 5 years ago

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.

naturallymitchell commented 5 years ago

they'll have a .rs and a .lua file in the handlers/ dir

eg #139

Arnaz87 commented 5 years ago

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.

naturallymitchell commented 5 years ago

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.

Arnaz87 commented 5 years ago

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

Arnaz87 commented 5 years ago

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

naturallymitchell commented 5 years ago

debug and bridge aren't handlers

Arnaz87 commented 5 years ago

I know, I also said so a few comments above, the only handler there is web_server

dariusc93 commented 5 years ago

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.

Arnaz87 commented 5 years ago

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

Arnaz87 commented 5 years ago

I agree with moving them out of src as well

naturallymitchell commented 5 years ago

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"

naturallymitchell commented 5 years ago

what about prelude/?

Arnaz87 commented 5 years ago

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

naturallymitchell commented 5 years ago

seriously? prelude is a Romance language word. (so yea, make sense to change).. but it's what Haskell calls their grammar thing.

naturallymitchell commented 5 years ago

http://hackage.haskell.org/package/base-4.12.0.0/docs/Prelude.html

naturallymitchell commented 5 years ago

and it's a music term.. how is it really that senseless for you? even if you haven't used haskell

Arnaz87 commented 5 years ago

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?

Arnaz87 commented 5 years ago

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.

naturallymitchell commented 5 years ago

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?

Arnaz87 commented 5 years ago

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.

naturallymitchell commented 5 years ago

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/

naturallymitchell commented 5 years ago

What about renaming handlers to lua?

what about environments/lua?