Commit Graph

474 Commits

Author SHA1 Message Date
Calvin Rose 4e31d85349 Address #804 - save and restore module cache when flychecking.
Calling flychecking cannot change the module cache.
2022-02-12 10:36:45 -06:00
Calvin Rose 461576e7a2 Add `defdyn` macro to allow docs and checking for dyns.
Using keywords for the names of dynamic bindings emphasized their
dynamic nature and how they actually work, but is opaque when it comes
to documentation and error detection. Janet uses early binding for name
resolution by default in most places, dyns should be no different.

The `defdyn` macro allows one to create aliases for keywords that can
have docstrings, be imported and exported, etc. The aliases _must_
follow the usual lisp convention of earmuffs - this is not
restricting since the underlying keyword lookup mechanism is still
completely accessible to users.

Example:

(defdyn *my-dynamic-binding* "Sends the plumbus to the thingamizer when
 enabled")

The above creates a normal binding (as created with `def`) for
`*my-dynamic-binding*` that is bound to the keyword
`:my-dynamic-binding`.

There is an optional prefix for defdyns that can be used to avoid name
collisions - *defdyn-prefix*

Example:

(setdyn *defdyn-prefix* "mylib/")
(defdyn *my-dynamic-binding* "Plumbus thingamizer")
(pp *my-dynamic-binding*)

> :mylib/my-dynamic-binding
2022-02-11 20:37:52 -06:00
Ian Shehadeh 6412768000 Add match documentation for & rest pattern 2022-01-20 09:19:21 -05:00
Ian Shehadeh 82688b9a44 add checks to & _ pattern in match macro
This commit adds 2 checks for & rest pattern in the match macro:
- & is followed by exactly 1 item
- & is followed by a symbol
2022-01-20 09:16:02 -05:00
Ian Shehadeh db631097b1 add support for & _ to match macro
This commit adds support for using & _ syntax to bind the remaining
values in an array in the match macro.

The commit also adds a few tests for the new syntax in suite0008
2022-01-19 13:29:34 -05:00
Calvin Rose a37dc1af9d Merge branch 'redefs-work'
- Change the global binding name from :redefs to :redef
- Simplify internal representation of "redefinable bindings"
- Store "redefinable bindings in :ref rather than :value inside the
  environment entries. This makes such bindings more like vars that
  can't be set rather than defs.
2022-01-06 20:45:20 -06:00
Calvin Rose 03458df140
Merge pull request #898 from pyrmont/feature.redefs
Support redefinable `def` and `defmacro` bindings using `:redef`
2022-01-06 20:44:18 -06:00
Calvin Rose 99cfbaa63b Tweaks on redef feature branch. 2022-01-06 20:38:15 -06:00
Michael Camilleri ea9d5ec793
Change metadata keyword back to :redef 2022-01-02 12:35:22 +09:00
Michael Camilleri ec65f038a8
Support :dynamic-defs dynamic binding 2021-12-29 16:39:00 +09:00
sogaiu 1326ded048 Tweak match docstring 2021-12-25 16:56:10 +09:00
Michael Camilleri 939d1dcae9
Only set :current-file in run-context if source is a path 2021-12-13 12:06:58 +09:00
Michael Camilleri bf29a54272
Clarify nested loop behaviour in loop macro 2021-12-09 10:41:56 +09:00
Calvin Rose e8c738002b Add extra "prefix" parameter to debug/stacktrace. 2021-12-04 13:03:05 -06:00
Grazfather 139bef2142 map: Fix indexing for 3+ data structures 2021-12-03 16:15:43 -05:00
Michael Camilleri 6bf9f89429
Update location of current file in run-context 2021-11-29 10:05:04 +09:00
Calvin Rose 425a0fcf07 Add quoted literal support in the match macro. 2021-11-08 15:33:11 -06:00
sogaiu fdc94c1353 Tweak short-fn docstring 2021-11-04 18:11:53 +09:00
Calvin Rose 9cc4e48124 Update changelog and allow evaluating streams with dofile. 2021-10-30 14:43:06 -05:00
Calvin Rose 9a06660fdb fix call to table/proto-flatten 2021-10-30 09:15:23 -05:00
Calvin Rose 5c35d24e13 Fix nil check issue. 2021-10-29 19:29:54 -05:00
Calvin Rose fd37567c18 Docstring fix. 2021-10-29 11:13:07 -05:00
Calvin Rose 8b2d278840 Add min-of and max-of. 2021-10-26 17:46:24 -05:00
Calvin Rose 74c9cf03d0 Fix -r switch in repl 2021-10-14 17:25:12 -05:00
Calvin Rose 50bced49ad
Merge branch 'master' into use-deprecation-mechanism-for-file-popen 2021-09-21 15:15:36 -05:00
Calvin Rose 033c6f1fdb Add -i flag to run .jimage files as scripts. 2021-09-19 19:47:57 -05:00
Calvin Rose 6c58347916 Remove thread module.
Instead, use the more general and non-blocing `ev/` module.
2021-09-19 14:19:32 -05:00
Calvin Rose b0d0d9cad2 Address #809 - treat first docstring line different from others.
Only do this if the docstring starts with an open parentheses.
2021-09-18 12:41:11 -05:00
sogaiu d5c8eb048a Apply deprecation machinery to file/popen 2021-09-18 17:08:56 +09:00
Calvin Rose 5464a7a379 Allow passing a function to directly to ev/go.
Makes ev/call less useful but ev/go more useful. No need
to construct as many identical intermediate fibers.
2021-08-30 22:22:22 -05:00
Calvin Rose b903433284 Merge branch 'master' of github.com:janet-lang/janet 2021-08-29 11:15:43 -05:00
Calvin Rose 9909adb665 Remove JANER_HEADERPATH from boot process.
That is a jpm thing.
2021-08-29 10:43:58 -05:00
Josef Pospíšil 29ea408980 Fix spawn-thread doc about its return 2021-08-28 15:39:49 +02:00
Calvin Rose 0ab96b8e47 Fix #771 2021-08-26 22:23:21 -05:00
Calvin Rose 846c9e5e12 Fix #759 - Add -E flag for one-liners.
Use the `short-fn` DSL here for argument passing.
2021-08-21 13:16:41 -05:00
Calvin Rose 685d2b460c Address #765. Make `assert` into a macro. 2021-08-21 12:27:58 -05:00
Calvin Rose e552757edc Fix threaded supervisor channels - Fix #766
Some pointer casting with abstract types was incorrect, resulting
in strange behavior when trying to use supervisor channels that were
threaded. This fix also adds the ability to supply a supervisor channel
directly when creating a thread.
2021-08-16 21:14:06 -05:00
Calvin Rose 87b8dffe23 Deprecate the thread module. 2021-08-15 17:36:47 -05:00
Calvin Rose 97e5117a3f Fix some issues and improve channel closing.
Still not fully working, seems to be deadlock/channel issue when
sending events between threads.
2021-08-15 13:14:33 -05:00
Calvin Rose c94d7574bc
Merge pull request #754 from harryvederci/patch-1
Improve docstring for the invert function.
2021-08-08 12:51:24 -05:00
Calvin Rose a38cb5df18
Merge pull request #757 from subsetpark/document-match
Add documentation of @ pattern in match
2021-08-08 12:51:00 -05:00
Zach Smith 5407868620 Add documentation of @ pattern in match 2021-08-07 15:09:37 -04:00
Harry Prins 7edf77561b
Refer to argument. Change past tense to present. 2021-08-07 18:03:10 +02:00
Calvin Rose bb5c3773f1 Fix fiber aware combinators to use general iteration instead of fiber
specifics.
2021-08-06 16:17:47 -05:00
Calvin Rose 2e641a266d
Merge pull request #752 from sogaiu/get-in-tweak
Tweak get-in behavior
2021-08-06 15:14:33 -05:00
Zach Smith 34019222c2 Make take/take-while/take-until fiber-aware 2021-08-06 15:40:29 -04:00
Harry Prins 5f3378213b
Improve docstring for the invert function. 2021-08-06 18:33:49 +02:00
sogaiu 2080ac3bda Tweak get-in behavior 2021-08-06 08:24:26 +09:00
Calvin Rose 7e5f226480 Put source mapping info in stack traces. 2021-07-29 21:29:08 -05:00
Calvin Rose 40561340a8
Merge pull request #721 from uvtc/patch-1
docs for doc, searching for strings
2021-07-26 15:21:39 -05:00