mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-05 04:44:12 +03:00
eb85906e52
* Meta: Fix hangs on calls to meta functions This commit fixes a subtle bug whereby setting the meta of an existing binder would cause hangs. Ultimately, this still points to an underlying issue in our Lookup code that causes such loops, but for now this at least fixes the hang introduced by the doc call in `core/Tuples.carp` (see issue #842). The primary fix seems to be related to setting the parentEnv in a case in which we failed to do so in `Eval.hs`. Additionally, our meta setting macros call `eval` which causes them to be evaluated *immediately after* expansion, causing them to be evaluated in the incorrect context in the Tuples.carp case. Additionally: - Refactored primitiveMetaSet and primitiveMeta to make them cleaner. - Only set `implements` early when we're certain we won't accidentally overwrite the interface. - Generalize DocStub to `MetaStub` so that it may be used for forward meta declarations of any kind. * Macros: Don't eval meta-set! macros Calling eval in the body of the meta-set! macros can cause them to be evaluated before anticipated, possibly setting the meta on a binding in the incorrect environment. An exemplary case of this issue existed in `Tuples.carp` (also fixed in this commit) whereby the generated defmodule for a tuple type called doc, which was evaluated *before* the emitted module, resulting in overwrites of global name docs instead of the expected module function. We retain `evals` in macros that are more useful in the repl, such as `print-doc`. If a user wants to evaluated one of the meta-set macros in the REPL, they'll need to add a call to eval. * Macros: Restore calls to eval Turns out the meta-set! macros *do* require calls to eval, unlike I reported in the previous commit. This commit restores those and replaces the `doc` call in `Tuples.carp` with a direct `meta-set!` to ensure we have docs for those functions. Also fixed a small error in implements primitive. * Primitives: Refactor i->inner in primitiveImplements |
||
---|---|---|
.. | ||
Array.carp | ||
ArrayExt.carp | ||
Bench.carp | ||
Binary.carp | ||
Bool.carp | ||
Byte.carp | ||
carp_bench.h | ||
carp_binary.h | ||
carp_bool.h | ||
carp_byte.h | ||
carp_char.h | ||
carp_debug.h | ||
carp_double.h | ||
carp_float.h | ||
carp_int.h | ||
carp_io.h | ||
carp_long.h | ||
carp_memory.h | ||
carp_pattern.h | ||
carp_safe_int.h | ||
carp_stdbool.h | ||
carp_stdint.h | ||
carp_string.h | ||
carp_system.h | ||
carp_utf8.h | ||
Char.carp | ||
Collection.carp | ||
Color.carp | ||
Control.carp | ||
Core.carp | ||
core.h | ||
Debug.carp | ||
Double.carp | ||
Dynamic.carp | ||
Filepath.carp | ||
Float.carp | ||
Format.carp | ||
Generics.carp | ||
Geometry.carp | ||
GLFW.carp | ||
Heap.carp | ||
Int.carp | ||
Interfaces.carp | ||
Introspect.carp | ||
IO.carp | ||
Long.carp | ||
Macros.carp | ||
Map.carp | ||
Maybe.carp | ||
Opaque.carp | ||
OpenGL.carp | ||
Pattern.carp | ||
Phantom.carp | ||
Pointer.carp | ||
Random.carp | ||
Result.carp | ||
SafeInt.carp | ||
SDL_gfx.carp | ||
SDL_image.carp | ||
SDL_mixer.carp | ||
SDL_ttf.carp | ||
SDL.carp | ||
SDLHelper.h | ||
Sort.carp | ||
StaticArray.carp | ||
Statistics.carp | ||
StdInt.carp | ||
String.carp | ||
System.carp | ||
Test.carp | ||
Tuples.carp | ||
Unit.carp | ||
Unsafe.carp | ||
Vector.carp |