From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 71a43385 for ; Mon, 22 Jul 2019 16:28:37 +0000 (UTC) Received: (qmail 1338 invoked by alias); 22 Jul 2019 16:28:30 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24085 Received: (qmail 29726 invoked by uid 1010); 22 Jul 2019 16:28:30 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua1-f45.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25517. spamassassin: 3.4.2. Clear:RC:0(209.85.222.45):SA:0(-2.0/5.0):. Processed in 3.001891 secs); 22 Jul 2019 16:28:30 -0000 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.222.45 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=r9qnLRPElSF9IPnLptoKG4IuZbS1VwaTPZHin7D+bXU=; b=VJKoyJQcauf7pLwtaPmLt6eOVQvom+qZQ7Q/lYkNDv5fQhpYh+TYefLKNCpOqMq04X ns4L5lPNQxNzCoaWzvaOI5eEtoamIHU9KXEgrdgpoSpLShfMteEh3o7hMFjmxwYMTOl/ ZNwj+KFAMc96SsZzaB37xABN4e+uyW17b/v54j8P/yVYwB+ajsQvLVGsXVYATEUn8vKI Tz6eciQPSq5NaiwVzfVn0Q+chhOxoXHWq8dzV1tw90YqlaqQDcWtMwlSkrnA4RavLr4l ZRG6CJcSLca3kKyxvavLc+weZwdKo5BsjVko2ulw37BhOOaX6EU0UNjAElTPBhqPNjfc Vpyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=r9qnLRPElSF9IPnLptoKG4IuZbS1VwaTPZHin7D+bXU=; b=HFcqgfEZkwa92zakEbTRreZT3Tpo9HYDzI7boFykUE4QWoOEq9UvIhV2U7OTcCsQKQ 3ZukxKOfkwdjHi8D8OvneHOcp6+LYyLo4PPG1iLgBcOzYw0yvbVqUESEIT4iJQOBW4I0 ZKzcl0GIx/BZIVrsQObCnAzw4HwZr92/cMdPm/KH8u6i9omfky2qR0oh7hcZrIPQIb76 0nAzd6JMwIAm3kIsamXY35lw2p6wnh7FmHeSACMaYL6Ia2WUkkZM3AUE5+VUa18sUvND qNDR7esXK186VWjcY3XFsx0HogNIlQ6VH4oxtTLiM/Ykvnhqpnyh3E8/kqckiwdI8J/W LDhg== X-Gm-Message-State: APjAAAX4CnFRQyCrycYBbowYvI29/VOTsydTHj2p4NDmaEOhME83vxhR HMBqEswGZuw7M/kAN0UK6Vem1rVoeoP1+WepmdAUV2H/O2g= X-Google-Smtp-Source: APXvYqxqA6SL+xD9okF33Q5lOvqlDRBn2kTwj2z+U2SZGStBcWBywFiKa43kEqWPjiTohUvaXuZWMh5evMgU35GOS4s= X-Received: by 2002:ab0:734f:: with SMTP id k15mr14577662uap.28.1563812873198; Mon, 22 Jul 2019 09:27:53 -0700 (PDT) MIME-Version: 1.0 From: Sebastian Gniazdowski Date: Mon, 22 Jul 2019 18:27:41 +0200 Message-ID: Subject: =?UTF-8?Q?ZQL_=E2=80=93_a_language_for_=2Adeclaring=2A_scripts_content=2E_?= =?UTF-8?Q?Any_ideas_for_changes_maybe=3F?= To: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, when I once tried NixOS, a system with declarative configuration at its core, i was naively expecting that I'll be able to declare zshrc. So, for example, that I'll be able to write some kind of rule "append command {X} to the end of the zshrc if it's not somewhere in the file". Turned out that those expectations were way out of the scale, as what was actually possible was to fill 3 configuration fields with the text of the zshenv, zprofile and zshrc. ZQL is to implement the feature. Example code: PRE { setopt #; print "**"; ls $ } ALTER { echo * "added" } POST { VALUE=3D* } 1. PRE and POST are the contextual surroundings of the inner code that does the editing. 2. The `setopt #` says: match setopt command that takes string. 3. So # denotes string. It doesn't matter if it's given as "#" or '#' or # =E2=80=93 it will match all three kinds of strings (unquoted, " and ' plus also $''). 4. Now, if instead of single # there will be two ##, then this is quotation-locked matching =E2=80=93 it matches strings with only the kind o= f quoting that's used for symbol. So, for example, '##' will match only 'string'. 5. # matches strings but not variables 6. To match also variables, there's the * symbol, with the same quotation-locking features. 7. To match variables, there's $ symbol (with the $$ counterpart as well). So, basically, the command matches a context of three preceding commands setopt, print and ls and one trailing command =E2=80=93 an assignm= ent VALUE=3D{anything}. After this, it then applies the middle editing block ALTER wchi; 1. Leaves 1st echo argument untouched (because it has * assigned) 2. Sets second argument to "added" This is how I imagine ZQL and the true declaring of zshrc contents. For more information you can take a look at the project's wiki: https://github.com/zdharma/declare-zsh/wiki/ZQL-draft Are there any easily detectable flaws in the idea? What else could be added to the language? The project has fairly sophisticated parsing already implemented. Currently, it allows to disable / enable zplugin's commands (that's how the project started; I'm thinking about exposing a plugin interface for other commands that might benefit from such highly-targeted approach) by providing a plugin name / pattern matching it. --=20 Sebastian Gniazdowski News: https://twitter.com/ZdharmaI IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin Blog: http://zdharma.org