Releases: cynkra/constructive
Releases · cynkra/constructive
constructive 1.0.1
- We fixed a typo that was breaking
.cstr_new_class(, commented = TRUE)
- We fixed a bug regarding high precedence infix operators that was breaking
deparse_call()
- "simpleUnit" is considered as a "grid" package class, not a "base" class and
we fixed the check for corrupted "simpleUnit" objects - The construction of "ScalesList" objects is improved, it failed in some cases
- The construction of "CoordCartesian" is improved and considers the "default" argument
- Improved vignette consistency
constructive 1.0.0
Internals, extension system, cosmetics
- The internals have changed quite a bit, and a new extension system has been
developed. - The vignette "extend-constructive" details it and how constructive works.
- The package {constructive.example} was updated to reflect the new system.
- We remove non API calls in the C code, to comply with new CRAN rules.
- The pkgdown website categorizes the functions so the package can be explored
more conveniently (Thanks Maelle Salmon @maelle for the suggestion). - The doc was improved overall
- The README was reworked
New functions
- Two new functions
construct_dput()
andconstruct_base()
allow to construct
objects respectively without using high level constructors at all, or using
only those included in base packages (such asdata.frame()
etc). - A new function
construct_clip()
is just likeconstruct()
but
copies code directly to the clipboard (Thanks Josiah Parry @JosiahParry for the suggestion). - We now have
opts_logical()
,opts_integer()
,opts_double()
,opts_complex()
,
opts_character()
andopts_raw()
so options can be set independently.
opts_atomic()
still works to set a. behavior for all atomics but the new functions have precedence.
The "raw" type is supported better can be constructed from integers in
decimal or hexadecimal notation with the "as.raw" constructor, or from
character using the "charToRaw" constructor. - The new functions
.cstr_new_class()
and.cstr_new_template()
facilitate the process of working with the new extension system.
New classes
- Expression vectors are now supported (For some reason we had missed it!).
- We implement constructors for the following base R classes:
- citationFooter
- citationHeader
- hexmode
- octmode
- person
- difftime
- simpleError
- simpleWarning
- simpleMessage
- simpleCondition
- errorCondition
- warningCondition
- We support the class "integer64" from the {bit64} package. It was important
because we can't recreateNA
or negative integer64 objects using base R only. - We support the class "blob" from the {blob} package.
New features and deprecation
- Many constructive functions gain the
classes
argument that generalize
construct_dput()
andconstruct_base()
, so users can enable or disable the idiomatic construction of some
classes. construct_reprex()
andconstruct_multi()
gain theinclude_dotted = TRUE
argument so we can optionally disable the construction of objects such as
.Random.seed
int he global environment or.Class
in the execution environment
of S3 methods.sconstruct()
andconstruct_multi()
gain the argumentsunicode_representation
andescape
previously used byopts_atomic()
and these are now not only
applied on strings but also on element names and variable names.- We look at the encoding when constructing character vectors, so an UTF-8
"é" is not constructed like a latin-1 "é" anymore. Hopefully this will help
some users out of encoding hell faster. opts_tbl_df()
gains ajustify
argument to control the justification of
columns withconstructor =
"tribble"` (Thanks Jacob Scott @wurli for the implementation).- The imports and lazydata environments of packages are constructed with
parent.env(asNamespace("pkg"))
andgetNamespaceInfo("pkg", "lazydata")
.
Before that they were constructed as regular environments. - When constructing environments we now lock environments and bindings when relevant.
- We construct negative zeroes as
-0
.identical(0, -0))
isTRUE
but
1/-0
is-Inf
so it made sense to support them. opts_environment()
gains a"predefine"
constructor and
opts_environment(predefine = TRUE)
is deprecated. The old way still works
but warns and is not documented anymore.- In
opts_atomic()
the argumentsunicode_representation
andescape
are
deprecated, use the newopts_character()
function or set them in the
main function directly instead so they also affect symbols and argument names.
The old way still works but warns and is not documented anymore.
Fixes
- We solve some operator precedence issues in
deparse_call()
- Named vectors of length 1 are constructed properly
- Objects are constructed properly if their names have attributes, contain
NA
s,
or are named likec()
's argumentsrecursive
anduse.names
- Circularity is detected when attempting to construct an environment refering to
itself with an inappropriate constructor. It now fails explicitly rather than
trigger an infinite loop or a low level error. NA
s andNaN
s are not conflated anymore when compressing double vectors- complex numbers are constructed properly regarding the different combination
ofNA
values in their real and imaginary parts. - We check for the S4 bit using
isS4()
and useasS4()
when necessary - In
opts_numeric_version()
,opts_package_version()
andopts_R_system_version()
the incorrectly named "atomic" constructor is replaced by a "list" constructor - data frames, data tables and tibbles are now properly constructed when they
contain columns that their idiomatic constructors cannot handle, such
as "row.names", or "stringsAsFactors" for data frames. - POSIXlt are constructed according to the R version, to account for the changes
in R 4.3.0 - We can construct objects with a ".Data" attribute, this used to fail because
structure()
has a.Data
argument. - The default "row.names" attribute is built with the
c(NA, -<nrow>)
form,
as indput()
, this solves some rare corner cases. - We fix some issues with raw strings when constructing character vectors
- We fix some issues with
NA
,NaN
,Inf
dates andNULL
timezones - We fix the environment attribute repair
- Functions with non syntactic formals are constructed properly
constructive 0.3.0
- A new debugging tool, the
construct_reprex()
function, is introduced.
It can be called in any function and will construct all variables and arguments
where it's called. construct_multi()
now constructs promises, in practice this is useful so
we can construct the evaluation environment of a function, including the uneavaluated
and potentially NSE args of a function- Set
options(constructive_print_mode = <character>)
where<character>
is a vector
of strings among"console"
,script
,"clipboard"
and"reprex"
. The default
behavior is "console". See `` ?constructive-global_options
opts_atomic(escape = FALSE)
(the default) now correctly uses surrounding single quotes
for strings that contain double quotes and no single quotes.deparse_call()
is more robusts and gains the argumentsescape
andunicode_representation
that were already present inopts_atomic()
- The ggplot object generation supports the internal changes of ggplot2 3.5.0,
and the resulting construction is nicer. - Data frames can be reconstructed when their columns don't have a
data.frame()
method - The "read.table" constructor for data frames supports the
one_liner
argument - roxygen2 is Suggested (not Imported anymore), the ellipsis dependency is removed
- formulas have a "next" constructor, useful to see what formulas are at a low
level - classes with S3 methods for
length
,[
,[[
etc are handled better .env()
doesn't crash anymore when provided a wrong or obsolete memory address- Integer vectors are constructed properly when they feature consecutive elements
differing by more than.Machine$integer.max
- Classed objects of types "..." and "externalptr" and are constructed properly
- S4 construction uses the
slot
argument rather than therepresentation
arg
constructive 0.2.0
- We don't use {styler} anymore, performance is sensibly enhanced as a consequence.
- The package works without having {prettycode} installed, but uses it if it's installed
- We default to using the magrittr pipe
%>%
for R versions that don't support|>
NA
levels are supported for the classes "factor" and "ordered"- Environment construction includes variables prefixed with a dot
- When we don't attach the package, we don't need to use
constructive::
in the...
beforeopts_*
functions, for instance we can callconstructive::construct(cars, opts_data.frame("read.table"))
. quote({})
is now constructed as"{ }"
rather than"`{`()"
constructive 0.1.0
v0.1.0 Sync workflows
v0.0.1: Merge pull request #80 from cynkra/f-add-news-file
original work before the big changes in #56