-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The great core shakeup #1992
Comments
this is... a lot. It'll take a bit for me to really parse what you're proposing. |
TL;DR: Delete a bunch of core stuff that's pointless in various ways, spin off most of the rest into a new library, and do some cleanup of special forms. |
There are definitely parts of this that I strongly agree with, such as renaming the model types, re-evaluating if everything in core is still needed and used, and suggesting something like Toolz or cytoolz. However, with a lot of the other stuff, I don't really have a strong opinion, and it will depend on the specific implementation details. |
That's fair. |
We should set up a document to keep track of the latest proposed changes as we discuss/refine/bikeshed them. Either updating the first comment here or a page in the wiki, perhaps? We should also address #1723 with this, as part of the bikeshedding. There are also some bugs with how |
If we get a Discord or other space set up (#1778) that would also be a great place to hash out the details of this plan! |
I was just going to edit the first comment.
Those sound like bugs, and should have their own issues. |
With regard to #1778, github now has discussions we can enable for this repo that have threads and everything. I think that would be a good place to start diving into this discussion. |
Went ahead and enabled discussions for Hy! Go check it out when you have the chance. It's still pretty new so we'll be figuring it out as we go, but it seems pretty nice so far. |
Regarding SkyHy, I was also thinking of Hyrule as an appropriately cute name, although maybe that's better reserved for a library about rules, or Zelda games. I'm inclined to use "Hylian" as a word for "Hy programmer", in any case. |
if And for SkyHy, i think we should follow the toolz and funcy organization of having submodules dedicated to specific categories, but everything available under the root level module if people want to just import/require everything like you can with toolz |
But |
its a core feature of async programming in python and I don't think its acceptable to make someone either write a macro or require it from a different package like skyhy just to do a core language feature. its an unnecessary hurdle to usability. |
You know that |
yes |
was the plan for |
No, it's just a rename. You can still use |
|
Seems to still be there to me:
|
ahhh, i see. its not in the documentation anywhere. It's just getting slurped up during bootstrap. Can we just get rid of it? We're already moving almost all the macros out of hy and the rest are getting moved to special forms anyways. Or just move it to skyhy 🤷♀️ |
Yes, I think it would be better to do without it; one should be able to raise errors in a macro the same way as elsewhere in Python. |
as @scauligi mentioned in #2050 now that ; Function return annotations have different ordering
(defn add1 ^int [^int x] (+ x 1))
(fn ^int [^int y] (+ y 2)) #2077 is already doing a lot so i'd probably just make it its own PR after that gets merged |
No objection here. |
This branch https://github.com/Kodiologist/hy/tree/hyrule is what I've done so far to remove Hyrule bits from Hy. At this point it's in pretty good shape except for the documentation. Next I'll make Hyrule itself, starting from a largely unaltered subset of a commit from Hy, and once I have Hy and Hyrule working together well, I'll open a PR to merge my |
Hy has a big and disorganized set of core functions and macros that get automatically injected into
__builtins__
. This is an improvement over the old status quo, in which they were automatically imported, but still messy. I propose some radical changes to clean things up. I'll do it over the course of several PRs, and we can bikeshed about the details (e.g., the fates of individual functions and macros) when we get there.__builtins__
.import
ing orrequire
ing stuff will behy
, core macros, and gensyms and other temporary names.quote
use qualified names to pull in model objects, so'5
will compile tohy.models.Integer(5)
instead ofInteger(5)
.if*
toif
.annotate*
toannotate
.fn*
in favor ofdefn
.with*
andwith/a*
in favor ofwith
andwith/a
,hy.core.shadow
to something more logical likehy.pyops
and encourage users to star-import it when they want first-class Python operators, as in(import [hy.pyops [*]])
.hy
, as e.g.hy.eval
:eval
mangle
unmangle
gensym
macroexpand
macroexpand-1
read
read-str
disassemble
repr
(formerlyhy-repr
)repr-register
(formerlyhy-repr-register
).hylang
,hyrule
, to hold a Hy library with a variety of functions and macros that are useful for Hy (and sometimes Python) but not required to implement Hy.extra
andcontrib
, except forhy-repr
.unless
do-n
list-n
lif
with-gensyms
defmacro/g!
as->
->
doto
->>
assoc
of
defmain
#@
comment
cfor
distinct
butlast
drop-last
rest
flatten
coll?
inc
dec
xor
parse-args
constantly
if
(useif*
, now calledif
, orcond
instead).if-not
(use(if (not …) …)
or(unless …)
instead).lif-not
(use(lif (not …) …)
instead).macro-error
.fraction
take-while
drop-while
remove
reduce
accumulate
count
cycle
repeat
*map
chain
compress
group-by
islice
tee
combinations
multicombinations
permutations
product
zip-longest
.fraction
for compiling fraction literals, but we don't need to advertise it to users.comp
complement
identity
iterate
juxt
merge-with
first
last
interleave
interpose
nth
partition
take
take-nth
second
drop
.empty?
even?
every?
float?
integer?
integer-char?
iterable?
tuple?
zero?
some
string?
symbol?
numeric?
odd?
neg?
pos?
none?
iterator?
keyword?
list?
instance?
- Use Python'sisinstance
instead.keyword
- Usehy.models.Keyword
instead.repeatedly
- Usetoolz.iterate
instead.calling-module
andcalling-module-name
internal to Hy.The text was updated successfully, but these errors were encountered: