h3rald / min

A small but practical concatenative programming language and shell
https://min-lang.org
MIT License
311 stars 23 forks source link

(Requiring Generics) "ERROR" define #93

Closed ghost closed 3 years ago

ghost commented 3 years ago

When i run min src\base.min command in terminal then i am receiving that error:

(!) src/mathutils.min(1,19) [require]: File 'src/stypes.min' does not exist.
    src/mathutils.min(1,19) in symbol: require
    src\base.min(1,22) in symbol: require

I suggest you to make a doc for module usage or load or require or import. Because i am so stucked with them and i am stucking again when i use generics. Generics have some problems, i think. Because generic implementation in operator signatures doesn't accept special types where are defined in some other modules:

( symbol mray
  ( (*stypes/char|*stypes/anynumber :t) ... )   ; <--- <ERROR>
  ()
) ::

Error says me that generic(t) has some undefined types.

I need help!

h3rald commented 3 years ago

You are right, load/require/import need better docs.

Meanwhile here are some tips: 😊

Hope it helps!

ghost commented 3 years ago

You are right, load/require/import need better docs.

Meanwhile here are some tips: 😊

  • The paths specified when using require/load are relative to the file where you are using require/load. In your case, remove src/ and it should work.
  • require should be used most of the time because it caches the file and doesn't re-execute it. load executed the file every time, which sometimes makes sense but rarely.
  • I am not a big fan of using invokes for referencing type classes in other files. Also you can't right now anyway! Try requiring your file containing type classes and then importing the module into the current scope: "mathutils" require import

Hope it helps!

Yes, you helped a lot!! Thanks.... 👍 👍 Worked.