You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem statement: Destructuring is incredibly useful when writing legible code, especially when the notebook user only wants several methods from a parent library. Currently, if one wants methods { A, B } from library lib, they would write:
Current workaround:
One way Observable users have achieved similar functionality when dealing with libraries is by creating a separate notebook that serves as a representation of the restructured cells. So assuming the above snippet was stored in a notebook called @lsh/lib, it could be imported as:
import{A,B}from'@lsh/lib';
Alternatively, some users push these management cells to an appendix section.
Prior art:
There is a pull request for this functionality at observablehq/parser#88, however it seems to have been abandoned due to possible lack of backwards compatibility with mutable cells.
Ideal functionality:
The ideal solution would be a single cell that allows:
{A,B}=require('lib');
however, as is referenced in the parser PR, wrapping the braces in parenthesis might be needed.
Problem statement: Destructuring is incredibly useful when writing legible code, especially when the notebook user only wants several methods from a parent library. Currently, if one wants methods
{ A, B }
from librarylib
, they would write:Current workaround:
One way Observable users have achieved similar functionality when dealing with libraries is by creating a separate notebook that serves as a representation of the restructured cells. So assuming the above snippet was stored in a notebook called
@lsh/lib
, it could be imported as:Alternatively, some users push these management cells to an appendix section.
Prior art:
There is a pull request for this functionality at observablehq/parser#88, however it seems to have been abandoned due to possible lack of backwards compatibility with mutable cells.
Ideal functionality:
The ideal solution would be a single cell that allows:
however, as is referenced in the parser PR, wrapping the braces in parenthesis might be needed.
Originally laid out at talk/4738.
The text was updated successfully, but these errors were encountered: