Skip to content

Run sequence of commands on trigger? #30

@nathanrboyer

Description

@nathanrboyer

How can I load a package and then define some constants?

This is working great!
(StucturalUnits.jl reexports Unitful.jl and exports inch.)

["@u_str", "Unitful", "inch"] => :(@usingany StructuralUnits),
julia> x = 2inch
2 inch

But I want more units available by default, and this is not working.

["@u_str", "Unitful", "inch", "mm", "psi"] => :(@usingany StructuralUnits; const mm=u"mm"; const psi=u"psi"),
julia> x = 2mm
┌ Info: Failed to run `begin
│     #= C:\Users\nboyer.AIP\.julia\config\startup.jl:43 =# @usingany StructuralUnits
│     #= C:\Users\nboyer.AIP\.julia\config\startup.jl:43 =#
│     const mm = u"mm"
│     #= C:\Users\nboyer.AIP\.julia\config\startup.jl:43 =#
│     const psi = u"psi"
│ end`
│   exception =
│    LoadError: UndefVarError: `@u_str` not defined in `Main`
│    Suggestion: check for spelling errors or missing imports.
└    in expression starting at C:\Users\nboyer.AIP\.julia\config\startup.jl:43
ERROR: UndefVarError: `mm` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
 [1] top-level scope
   @ REPL[1]:1
 [2] top-level scope
   @ none:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions