About.jl

Mirror of https://code.tecosaur.net/tec/About.jl
Author tecosaur
Popularity
119 Stars
Updated Last
2 Months Ago
Started In
March 2024

About.jl

Sometimes you want to know more about what you’re working with, whether it be a function, type, value, or something else entirely.

This package is a utility to help answer that question, it exports a single function about, which can be applied to any Julia object.

This makes heavy use of the new AnnotatedString type provided in Julia 1.11. While it can be used with Julia 1.9 and 1.10, the package load time is dramatically worse.

Examples

These examples should give an impression of what about does in practice, though without some of the 🌈pizazz✨ you’ll see if you try it yourself.

julia> about(About)
Module About [69d22d85-9f48-4c46-bbbe-7ad8341ff72a]
  Version 0.1.0 loaded from ~/.julia/dev/About

Directly depends on 4 packages (+9 indirectly):
β€’ PrecompileTools (+5)  β€’ InteractiveUtils (+3)  β€’ StyledStrings  β€’ JuliaSyntaxHighlighting (+1)

Exports 2 names:
β€’ About  β€’ about
julia> about(β„―)
Irrational{:β„―} (<: AbstractIrrational <: Real <: Number <: Any), occupies 0B.
singelton
julia> about(Float64(β„―))
Float64 (<: AbstractFloat <: Real <: Number <: Any), occupies 8B.

 0100000000000101101111110000101010001011000101000101011101101001
 β•¨β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
 +    2^1   Γ—                1.359140914229522545
 = 2.7182818284590451
julia> about('√')
Char (<: AbstractChar <: Any), occupies 4B.

     β”Œ2─┐   β”Œ2β”€β”β”Œβ”€β”€1β”€β”€β”β”ŒA─┐
 11100010 10001000 10011010 00000000
 └─0xe2β”€β”˜ └─0x88β”€β”˜ └─0x9aβ”€β”˜ └─0x00β”€β”˜
 = U+221A

 Unicode '√', category: Symbol, math (Sm)
julia> about(Dict{Symbol, Int})
Concrete DataType defined in Base, 64B
  Dict{Symbol, Int64} <: AbstractDict{Symbol, Int64} <: Any

Struct with 8 fields:
β€’ slots    *Memory{UInt8}
β€’ keys     *Memory{Symbol}
β€’ vals     *Memory{Int64}
β€’ ndel      Int64
β€’ count     Int64
β€’ age       UInt64
β€’ idxfloor  Int64
β€’ maxprobe  Int64

 β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– β– 
    *       *       *       8B      8B      8B      8B      8B

 * = Pointer (8B)
julia> about(sum, Set{Int})
sum (generic function with 10 methods)
 Defined in Base(8) extended in Base.MPFR(1) and Base.GMP(1).

 Matched 1 method :: Int64
  sum(a; kw...) @ Base reduce.jl:561

 Method effects
  βœ— consistent     might not return or terminate consistently
  βœ” effect free    guaranteed to be free from externally semantically visible side effects
  βœ— no throw       may throw an exception
  βœ— terminates     might not always terminate
  βœ” no task state  guaranteed not to access task state (allowing migration between tasks)
  ~ inaccessible memory only  may access or modify mutable memory iff pointed to by its call arguments
  βœ— no undefined behaviour  may execute undefined behaviour
  βœ” non-overlayed  may call methods from an overlayed method table

Used By Packages

No packages found.