gilch / hissp

It's Python with a Lissp.
https://gitter.im/hissp-lang/community
Apache License 2.0
364 stars 9 forks source link

Excise Extras and replace with Pack #244

Closed gilch closed 8 months ago

gilch commented 8 months ago

Closes #187.

This overhauls/replaces the Extra system, which I was unsatisfied with. ! is no longer a reader macro. = is now magic in tags. Kwargs are now much easier to use with tags. The confusing reordering with the primary argument being written last is gone. Pack replaces Extra and can be used as a reader macro return value, but it counts as a positional argument.

Unfinished business: I removed the section about reader macros in the Style Guide and about Extras in the Whirlwind Tour. They will need some kind of replacement. (I did add sections to the Primer, but they probably need revision.) I removed tests that were only concerned with Extras but might not have full coverage for their replacements. The code implementing this in the reader probably needs a refactor.

I'm not sure if this approach will be satisfactory either, but I need more experience with it to know that. It also has implications for how I'd implement the Garden of EDN tags and the synexpand macro family. Those have the potential to change my mind until they're nailed down.

codecov[bot] commented 8 months ago

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (fdd447c) 100.00% compared to head (9bf1162) 97.67%.

Files Patch % Lines
src/hissp/reader.py 66.66% 12 Missing and 5 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #244 +/- ## =========================================== - Coverage 100.00% 97.67% -2.33% =========================================== Files 6 6 Lines 719 730 +11 Branches 113 113 =========================================== - Hits 719 713 -6 - Misses 0 12 +12 - Partials 0 5 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

gilch commented 8 months ago

How do multiariy aliases work now?

(alias B builtins.)

What is this insanity?

#> end=B#.##"X\n" print 
X
>>> None

Madness!

Slightly better spellings (slightly):

#> B#=end=#print .##"X\n"       
X
>>> None
#> =B#print end=#.##"X\n"  
X

Maybe prefixes were a mistake.

With postfixes

B/end#print .##"X\n"

With raw symbols #209

B/end#print|"X\n"|

Still not ideal.

gilch commented 8 months ago

Well, it pretty much works, but I don't think I like it. I may reuse some commits or ideas, but I don't think I'll be merging this one.