carp-lang / carp-lang/Carp

register-type for generics

Open
#592 1 comment 0 reactions 0 assignees View on GitHub
haskell nice-to-have under discussion
Dominant language
Haskell
Stars
6k
Forks
187
Avg merge
8d 22h
Merged PRs (30d)
4

Description

What if we allow something like:

```
(register-type (FixArray Int t))
```

That would then emit something like this for `(FixArray 256 Char)`, in the vein of https://github.com/carp-lang/Carp/pull/581:
```
#define INT0 256
#define T Char
#include "fixarray.h"
#undef T
#undef INT0
```
AFAICS it would make extending the language with new types easier and also would allow removing things like `Array` from the compiler.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the register-type proposal and the implementation discussed in PR #581, then inspect how Array is currently handled by the compiler. Determine the design needed for generic type registration and preprocessing substitutions. Done means the example supports FixArray with generic parameters and the intended built-in Array handling can be removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.