eduardoleao052 / js-pytorch

A JavaScript library like PyTorch, built from scratch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Modules + block scoping variables

medic-code opened this issue · comments

I noticed in the code you're using IIFEs and var variables and wondered whether you had in mind tousing block scoping variables (let and const) and modules ?

I know it's probably on your list to do some refactoring of torch.js but modules would allow for extracting some common functionalities out of the torch.js file. Would be happy to help start some of that.

Hey, thanks for looking it over, glad you like it! I'm definitely planning to refactor the code in the coming days. On that note, what exactly do you mean by using modules to allow for extracting some common functionalities? Thanks in advance!

I see you're using IIFEs to avoid polluting the global scope but you would get that with out of the box with commonjs modules. It might be that you're making it more accessible to everyone who's learning JS that's also fine but was just curious to the approach!

I see, that's a good approach as well!