Don't unwrap CLJC lib specs when cleaning a namespace

オープン
#266 コメント 4 件 リアクション 4 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
clojure
領域
tooling

調査の方向性

まず、namespace の :require フォームを処理する cljr-clean-ns エントリポイントを追跡し、CLJC reader-conditionals がどのように展開されるかに注目します。この issue のサンプル namespace を入力として使用し、既存の条件構造が完全に展開されるのではなく保持されること、また、すでに完全に展開されたフォームは変更されないことを確認します。

索引モデルが issue の本文から書いたものです。

説明

enhancement

We have a namespace like this:

(ns my.app.ns
  (:require [vlad.core :as vlad :refer [attr chain join present Validation]]
            #? (:cljs [goog.date.Interval :as Interval])
            [clojure.string :as string]
            [cemerick.url :as url]))

after running cljr-clean-ns, it fully expands the clj and cljs versions to:

(ns my.app.ns
  #?@
   (:clj
    [(:require
      [cemerick.url :as url]
      [clojure.string :as string]
      [vlad.core :as vlad :refer [attr chain join present Validation]])]
    :cljs
    [(:require
      [cemerick.url :as url]
      [clojure.string :as string]
      [goog.date.Interval :as Interval]
      [vlad.core :as vlad :refer [attr chain join present Validation]])]))

This namespace form is twice as long, and (IMO) obscures which parts of the namespace differ between clj and cljs. To tell the difference, you need to check each line and find the corresponding one in the other branch.

Would you consider a feature request to not fully expand CLJC forms in the :require?

I'd argue this should be the default behaviour, but could also see it being an option if people liked this kind of expansion. The new feature wouldn't automatically convert fully expanded CLJC forms back, it would just preserve what was already there.

主要言語
Clojure
スター
261
フォーク
68
平均マージ
10時間 36分
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

clojure-emacs/refactor-nrepl のほかの issue

clojure-emacs/refactor-nrepl の issue をすべて見る

似ている issue

Clojure の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。