3 ms·
I would like to use a language that doesn’t involve sizeof(typeof...) and template(Tmagic...) both. #include “meta.h” @tr max(@ta a, @tb b) if (is_com
by wruza 9y ago
I would like to use a language that doesn’t involve sizeof(typeof...) and template(Tmagic...) both.
#include “meta.h”
@tr max(@ta a, @tb b)
if (is_comparable(ta, tb))
tr = common_base(ta, tb, optionshere...)
produce_code {...}
else
compile_error “incompatible types in $(__func__)”
I can’t figure out for decades why can’t we just get all ideas from lisp and code in happiness.
- devit 9y agoLisp has hard to read syntax and no static type system, so not really something to imitate.
- dragonwriter 9y ago> Lisp has hard to read syntax and no static type system, The first is subjective, and there are Lisp-family languages with static typing.
- wruza 9y agoI think I should stress out that my hope is not to use lisp instead of our languages of choice, but to simplify metaprogramming tasks in them with at least equally simpler approaches that lisp has. E.g. all C constructs can be described in a set of structs. IfStmt, CallStmt, BinopExpr, etc. Generating or inspecting these on the fly could allow to create hundreds of metaprogramming frameworks, few of which could prove their best fit. But instead we locked in ugly cpp macros and C++ templates that even seasoned haskell monader hardly understands and has no tools to explain. Debugging is hard and manual, metadebugging is not even a thing, cppcheck and other code analysis tools are enormously complex and rare, apple ARC is a propietary language feature for NSObject instead of two pages of metacode available to anyone with an “int rc” in their struct. I hope that snippet above is now more clear.
- _asummers 9y agoThat looks very similar to an Elixir macro (heavily influenced by Lisp macros). If you haven't checked that language out, you might find yourself liking it.