Deutsch   English   Français   Italiano  
<vridg1$c9ev$2@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: Bart's Language
Date: Fri, 21 Mar 2025 00:56:34 +0000
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <vridg1$c9ev$2@dont-email.me>
References: <vracit$178ka$1@dont-email.me> <vrbo88$1j3e0$1@paganini.bofh.team>
 <vrbtve$2irc9$1@dont-email.me> <vrc2d5$1jjrf$1@paganini.bofh.team>
 <vrcri2$3doia$1@dont-email.me> <vri5c8$26v8m$1@paganini.bofh.team>
 <20250320163436.941@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 21 Mar 2025 01:56:33 +0100 (CET)
Injection-Info: dont-email.me; posting-host="01edc3bdc8bae69ef7cb5aa841da74a4";
	logging-data="402911"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19Y0W6VbayvbgwGTXW0RWE0"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:JF2OdZNcp2yoYoYZL9hS5rPXyxY=
Content-Language: en-GB
In-Reply-To: <20250320163436.941@kylheku.com>
Bytes: 3184

On 20/03/2025 23:45, Kaz Kylheku wrote:
> On 2025-03-20, Waldek Hebisch <antispam@fricas.org> wrote:
>> bart <bc@freeuk.com> wrote:

>>> In this case, just write it like that, and only adjust it for the
>>> somewhat different syntax:
>>>
>>>    func foo:int =
>>>        let int c := c1(10)
>>>        let int b := c + c2(2)
>>>        let int a := b+c3(c)
>>>        bar()
>>>        baz()
>>>        return c
>>>    end
>>
   >> In your description you wrote that declarations can be written
>> "out of order" and compiler will rearrange them in correct
>> order.  That looked like great opportunity to write obfuscated
>> code.
> 
> I made a language feature like that: mlet.
> 
> https://www.nongnu.org/txr/txr-manpage.html#N-2B3072E9
> 
> This allows for circular references in order to support
> the construction of lazy objects:
> 
> 1> (mlet ((a (lcons 1 b))
>            (b (lcons 0 a)))
>      (take 20 a))
> (1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0)

I don't understand what's going on above; the example here is a bit 
clearer, other than that z at the end:

   (mlet ((x (+ y 1))
          (y (+ z 1))
          (z (+ x 1)))
     z)

But this looks like something that goes on at runtime. In the language 
above, it's all dealt with at compile time. If I create a similar example:

  const x = y + 1,
        y = z + 1,
        z = x + 1

then it is the compiler that reports a circular reference.

Otherwise, in my dynamic (and non-lazy) language, circular references 
are allowed at runtime, but it is object references rather than names:

    a ::= (1,2,3)   # create two short lists (::= makes a mutable copy)
    b ::= (4,5,6)

    a &:= b         # append each to the other (concatenate is
    b &:= a         # well-behaved)

    println a
    println b

Shows two now infinite lists:

   (1,2,3,(4,5,6,(1,2,3,(4,5,6,...))))
   (4,5,6,(1,2,3,(4,5,6,(1,2,3,...))))

(An attempt to deep-copy one of those will end badly.)