[HN Gopher] Emacs Lisp shorthands as namespacing system
___________________________________________________________________
Emacs Lisp shorthands as namespacing system
Author : gjvc
Score : 53 points
Date : 2022-11-27 19:18 UTC (3 hours ago)
(HTM) web link (andreyorst.gitlab.io)
(TXT) w3m dump (andreyorst.gitlab.io)
| ahungry wrote:
| I've been using https://github.com/Malabarba/Nameless for awhile
| now - it's functionally very similar to the new Emacs shorthands
| feature.
| nonrandomstring wrote:
| For me, Python's "from library import module as myname" is
| unbeatable. I like to choose my own namespaces and assign
| whatever bits of a lib to it as I feel like. It seems robust and
| flexible.
| nerdponx wrote:
| This usage is so idiomatic and ubiquitous that you can see
| "np." or "pd." or "plt." in just about any code and assume that
| the user is using Numpy or Pandas or Matplotlib.
|
| Now that I think about it, I really should set up a "snippet"
| to type this for me: import matplotlib.pyplot
| as plt import numpy as np import pandas as pd
| smcl wrote:
| Importing a namespace under an alias exists in a few languages
| nerdponx wrote:
| I don't like the conflation of "-" as both "word separator in the
| name" and "namespace". I prefer keeping the "/", so you would get
| "snu/lines" instead of "some-nice-string-utils/lines". Otherwise
| I think this article is great, and I don't see why more languages
| don't use this kind of system, instead of dumping all symbols in
| the imported namespace into the current namespace.
___________________________________________________________________
(page generated 2022-11-27 23:00 UTC)