Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Mild Shock Newsgroups: sci.math Subject: How compile a DSL, does it need Types? (Re: Side Note, Why not DSLs?) Date: Fri, 3 Jan 2025 22:52:17 +0100 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 3 Jan 2025 21:52:17 -0000 (UTC) Injection-Info: solani.org; logging-data="2291609"; mail-complaints-to="abuse@news.solani.org" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19 Cancel-Lock: sha1:82GR7fYak9IF7e1d9lr2D001LGw= X-User-ID: eJwNzIERACEIA7CV4KQo42Cl+4/wnwGClZ7ckciAoKnyOmOsoGaBdzwVfQdVzXp6NFib+1XosD2Wzn9g5978AHXDFjQ= In-Reply-To: Hi, Well you don't need always types. JavaScript has also no types. And there is a trend to have gradual types. Make them kind of optional and arive at TypeScript. If I am not mistaken, you can omit Types in TypeScript here and then, and simply get JavaScript. You can still prove things about, just assume that you have an "any" type. What other benefit do you think have types? For example the Floyd Warshall algorithm in DSL works without any declared types although it has a manifest type of matrice somehow. Also many Program transformations, such as the compilation of the DSL doesn't need types. Here you see the compilation of the DSL, I just turned the helper predicate into expansion rules: goal_expansion(let V = E, let2(E,V)) :- var(V), !. goal_expansion(let D[R,C] = E, (let2(E,V), arg(R, D, H), nb_setarg(C, H, V))). goal_expansion(let2(V, V), true) :- var(V), !. goal_expansion(let2(D[R,C], V), (arg(R, D, H), arg(C, H, V))) :- !. goal_expansion(let2(E+F, R), (let2(E, V), let2(F, W), R is V+W)) :- !. goal_expansion(let2(V, V), true). goal_expansion(if E > F, (let2(E, V), let2(F, W), V > W)). Sadly I don't have yet goal expansion in Dogelog Player. But SWI-Prolog has it. I might introduce it in the next release provided I find an ultra simple solution. Or an inline directive. Bye The SWI-Prolog thread was this: https://swi-prolog.discourse.group/t/floyd-warshall-algorithm-in-prolog/8685 Mild Shock schrieb: > The original post was: > > Subject: Chicken and egg, with curry? > > Partial and tentative: > > ``` >   Functional = Closures/applications, Reduction/canonicity >     /    | > Logical  |   = Predicates/queries, Resolution/subsumption >     \    | >   Imperative = Procedures/invocations, Execution/... > ``` > > And there are two views of that triangle: Logical is the top of the > *ideal* such triangle, along the lines of a universe with Prop on top, > which we can reason with; Imperative is the bottom of a *concrete* such > triangle, the bootstrap as well as the final point of application of any > concrete system. > > And Logical is the constructive (structural) type-theory founding the > Functional, where Functional exists for expressivity and modularity > (what else?), plus can be compiled back/down to machine language... > > Right? > > -Julio > > Chris M. Thomasson schrieb: >> On 1/3/2025 1:20 PM, Mild Shock wrote: >>> Hi, >>> >>> Just a side note, don't let you get distracted. >>> A side node about the chicken/egg problem, i.e. >>> without the curry: >> [...] >> >> What about this... The universe was never created simply because it >> was always there. It will always be there, and never cease to exist? ;^) >> >