From nobody Sun Jan 31 17:51:37 2021 Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by mail-b.sr.ht (Postfix) with ESMTPS id 451B411F029 for <~technomancy/fennel@lists.sr.ht>; Sun, 31 Jan 2021 17:51:37 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id s23so9174487pgh.11 for <~technomancy/fennel@lists.sr.ht>; Sun, 31 Jan 2021 09:51:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nuLI9EREufznEo2+Ox0ksDFMlHKfx5ZE9Gz01IFFgNw=; b=gi3bwmihLLBPwtJgwON6axkBNNJwXtisxNR3h1NxsTrXa88BZjmXjrtwf9Ay/FHUqA A+OJ49MUy0cOJkfDBtMGxRMteCMOkcoEvQbtKzrNBeQ7o4cJ4n5/aUg3E+4kuobd9aCB HiBxz2Tpde/WMlMvtGoqcDdsCj2NqHacGIutaWuPtZCj6JT09iUEL+0SUKZTuW9nYNFU 4wlhuCuQ9znMfj48Vg5b3j0v7OVyRy9TuBhQwHL4XSmC/Hmzo6KPmJysUFQPUUXSmXEw /jeiY9SEyHV3ma03U7l2O7gM1KKHKDGC2WlSyWVhdOljS+NlBiptqpfIlPkGH5/H/w84 APSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nuLI9EREufznEo2+Ox0ksDFMlHKfx5ZE9Gz01IFFgNw=; b=fOCIBBHvXlK7REGh1qmU9rrLfrYjcq47BX6FD4/HtDLIMJSvnCvV+MU6ZR9vd2qp3C TIlRh2j4o5h5kJVVdjq0vMXzr87yRLHHPuFdoS43GQcKKdZ/RVCkkR27oZx4VfsxQp01 FQ/YYKoQME9gGXwtYuzyqECySL3HhFLKaq8HXdDt+G/PwIzgIL5kxcLKfZ26jfcwNyoS zZDPXhF4xFXYNlRI4qWqriWmn94jWat97RVdr4ktSxCzykSVqNoXfQ2ZMPsB82IWLMkc atVl6MTP1Tj4EKB0C2h3rqqo3xO3Foso7bRl8LkwlX6hprZBUy5MRWcpQ0CDEeXNJ9Ru ghpA== X-Gm-Message-State: AOAM533UCl0NNTJPEVP24Q/eFWzZ9GweuhjMq8FURztdaW4zwJaSw+Xy kwg6OZWFl4F5A9dSF+8yA+hE7YnQwBjwDn/7JiQ= X-Google-Smtp-Source: ABdhPJzvLyoB/PmjkBjfh3IywZmwW+qsYtmRbQPtOjzslNkq9Cpk/I0FsUQvi+IIEX1IRxytnY0eTgwrtLV9rXBmHkE= X-Received: by 2002:a63:1214:: with SMTP id h20mr12981017pgl.379.1612115495930; Sun, 31 Jan 2021 09:51:35 -0800 (PST) MIME-Version: 1.0 References: <878s89yq0f.fsf@whirlwind> In-Reply-To: <878s89yq0f.fsf@whirlwind> From: Andrey Orst Date: Sun, 31 Jan 2021 20:51:24 +0300 Message-ID: Subject: Re: Raw string syntax proposal for Fennel To: Phil Hagelberg Cc: ~technomancy/fennel@lists.sr.ht Content-Type: text/plain; charset="UTF-8" On Sun, Jan 31, 2021 at 8:28 PM Phil Hagelberg wrote: > This seems like a downside to me. The notation is already unpredictable > enough that allowing nesting just makes it worse. If we introduce a new > string type, the rules around it need to be extremely simple. Raw > strings should be raw; the idea of treating certain things differently > inside a raw string specially seems to defeat the purpose. The only > thing that's not interpreted as string content should be the closing > delimiter. If you need a string which contains the closing delimiter, > you'll just have to use normal strings with escaping. Perhaps I wasn't clear enough here. Lua raw strings can be nested too, and this is done by using [=[ and ]=] delimiters, where amount of = signs can be increased to contain nested raw strings. The notation I'm suggesting here is a plain mapping on Lua raw string notation, except of using [=[ we use r" to open the string, and instead of ]=] we use a matching "r. Ability to nest raw strings is the main point of string being raw -- it preserves everything inside, even other raw strings. > The idea of emitting strings differently depending on what notation was > used to input them seems problematic. This is the side effect of supporting a feature of the host language but with a different syntax. Lua programmers do this manually -- when square brackets need to be used in raw string, different raw string delimiters are entered manually. Since the proposed syntax doesn't allow controlling what delimiter to use, mangling is required. I mean if Lua programmer wites a lua sting like this (for some reason) [=[[[]][[]]]=], the [=[ and ]=] are inserted manually. Since we can't allow such syntax, when writing r"[[]][[]]"r, compiler has to do mangling r" into [=[, and "r into ]=] to produce correct Lua raw string. Also > depending on what notation was used A slight correction here - depending on string contents, not the notation. The notation implies mangling, but the mangling is always based on contents, just as with regular Fennel identifier mangling. -- Best regards, Andrey Listopadov