[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Re: Functions as first-class objects
- From: "szbnwer@..." <szbnwer@...>
- Date: Sun, 2 Sep 2018 03:36:03 +0000
hi Alejandro Reimondo and others! :)
1st of all, why do you need this? for your pleasure, experimenting,
for a specific task/problem domain, you just wanna hack a tool for
your ideas on cool basics like lua or what else?
this sounds like smalltalk, however thats a very different beast. even
if you can achieve anything like you would actually like to see, then
this way you will find yourself hitting dead-ends all around when you
will try to move forward on hackish funds. i think this is the best
indicator for knowing that you are actually hacking :D if you really
want to make a different beast from lua, then your best way to go is
to manipulate its source, but then you will find yourself far from the
"civilization" aka the libs written to lua, right on your very small
island...
i can deeply understand the desire for such flexibility as smalltalk
and lisp have cuz the very homogeneous funds, and then you kinda wont
ever find yourself in a dead-end. however lua have really huge
flexibility as ive only used metatables once (for weak keys or values
in a register table, dunno) from (i think) 2015. 1. 1. when i started
to use lua, cuz ive never really needed them. nor coroutines. however
i believe 1 day i will need them for whatever purpose, but now i know
im far from the edges of the flexibility that lua actually have. til
that time arrives, ive got less overhead for no reason. ive got more
plans for a single app than what a single person could make in a
lifetime, and i can see nothing at all that is not achievable with the
very-very powerful toolset of lua, and i really like to hack around :)
so i believe youve got an "xy problem" and its easily resolvable but u
need to refactor your mental constructions for the aims you have. you
can have closures for hiding values, u can have fallbacks for
inheritance, constructors for instances, supervisors for extending
basic functionality, factories for whatever (i love them), wrappers,
iterators, message queues, event loops ..... and anything you can wish
for, but u probably must think a bit different 1st. you can insert
operators between operands if you think like 1+1 can be written as
op('+', 1, 1). you can reconstruct loops, blocks, functions and any
control structures with tables and functions, and you can include any
kinda flexibility and customization on the way doing so. however i
believe these are the best if they are not overused but used only when
the actual need says so, but oop principles are dictating for people
to use all of its goodies even when they are totally not needed for
nothing and they are making a huge mess (to follow up whats happening,
but it looks like a shiny well ordered library) with much overhead ...
so much unnecessary extra complexity is involved kinda much always....
btw this is my personal opinion, so i could really stop writing after
the basic question about your actual aim, just wanted to give some
ideas to think outside the box in the hope that it could help anything
:)
so think about metatables as they are _generally_ only for hiding
functionality, and then you can realize that you dont really need
them, just they are convenient as they are hiding some stuffs. i think
something that can take the message and the target (+what more; and
that can have any well organized background info) could resolve ur
actual problem without hiding some details, but with great power! :)
bests! :)