Skip to content

Commit 80fa93a

Browse files
authored
Merge pull request #369 from yamacir-kit/cleanup
Cleanup
2 parents 2c5efbd + 628e29c commit 80fa93a

File tree

8 files changed

+29
-165
lines changed

8 files changed

+29
-165
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ sudo rm -rf /usr/local/share/meevax
100100

101101
| Target Name | Description
102102
|:-------------------|:--
103-
| `all` (default) | Build shared-library `libmeevax.0.3.783.so` and executable `meevax`.
103+
| `all` (default) | Build shared-library `libmeevax.0.3.791.so` and executable `meevax`.
104104
| `test` | Test executable `meevax`.
105-
| `package` | Generate debian package `meevax_0.3.783_amd64.deb`.
105+
| `package` | Generate debian package `meevax_0.3.791_amd64.deb`.
106106
| `install` | Copy files into `/usr/local` __(1)__.
107107
| `install.deb` | `all` + `package` + `sudo apt install <meevax>.deb`
108108
| `safe-install.deb` | `all` + `test` + `package` + `sudo apt install <meevax>.deb`
@@ -117,7 +117,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's
117117
## Usage
118118

119119
```
120-
Meevax Lisp System, version 0.3.783
120+
Meevax Lisp System, version 0.3.791
121121
122122
Usage: meevax [OPTION...] [FILE...]
123123

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.783
1+
0.3.791

include/meevax/iostream/escape_sequence.hpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919

2020
#include <tuple>
2121

22+
#include <meevax/functional/curry.hpp>
2223
#include <meevax/iostream/is_console.hpp>
23-
#include <meevax/utility/unwrap_reference_wrapper.hpp>
24+
#include <meevax/iostream/write.hpp>
2425

2526
namespace meevax
2627
{
@@ -47,20 +48,15 @@ inline namespace iostream
4748

4849
friend auto operator <<(std::ostream & os, escape_sequence const& sequence) -> std::ostream &
4950
{
50-
auto print = [&](auto&& ... xs) -> std::ostream &
51-
{
52-
return (os << ... << unwrap_reference_wrapper(xs));
53-
};
54-
5551
if (is_console(os))
5652
{
5753
os << "\x1b[" << sequence.command;
58-
std::apply(print, sequence.references);
54+
std::apply(curry(write)(os), sequence.references);
5955
return os << "\x1b[0m";
6056
}
6157
else
6258
{
63-
std::apply(print, sequence.references);
59+
std::apply(curry(write)(os), sequence.references);
6460
return os;
6561
}
6662
}

include/meevax/iostream/write.hpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@
1919

2020
#include <iostream>
2121

22+
#include <meevax/utility/unwrap_reference_wrapper.hpp>
23+
2224
namespace meevax
2325
{
2426
inline namespace iostream
2527
{
26-
struct write
28+
auto write = [](std::ostream & os, auto&&... xs) -> std::ostream &
2729
{
28-
template <typename... Ts>
29-
constexpr auto operator ()(std::ostream & os, Ts&&... xs) const -> std::ostream &
30-
{
31-
return (os << ... << xs);
32-
}
30+
return (os << ... << unwrap_reference_wrapper(xs));
3331
};
3432
} // namespace iostream
3533
} // namespace meevax

include/meevax/kernel/heterogeneous.hpp

+10-16
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include <meevax/functional/compose.hpp>
2121
#include <meevax/iostream/escape_sequence.hpp>
2222
#include <meevax/iostream/write.hpp>
23+
#include <meevax/kernel/overview.hpp>
2324
#include <meevax/kernel/profiler.hpp>
24-
#include <meevax/type_traits/delay.hpp>
2525
#include <meevax/type_traits/is_equality_comparable.hpp>
2626
#include <meevax/utility/module.hpp>
2727

@@ -69,7 +69,7 @@ inline namespace kernel
6969

7070
auto write(std::ostream & os) const -> std::ostream & override
7171
{
72-
return delay<iostream::write>().yield<decltype(os)>(os, static_cast<Bound const&>(*this));
72+
return os << static_cast<Bound const&>(*this);
7373
}
7474
};
7575

@@ -84,14 +84,9 @@ inline namespace kernel
8484
current_profiler()[typeid(typename std::decay<Bound>::type)].allocation++;
8585
#endif
8686

87-
if constexpr (std::is_same<Bound, Top>::value)
88-
{
89-
return static_cast<heterogeneous>(new (gc) Top(std::forward<decltype(xs)>(xs)...));
90-
}
91-
else
92-
{
93-
return static_cast<heterogeneous>(new (gc) binder<Bound>(std::forward<decltype(xs)>(xs)...));
94-
}
87+
return static_cast<heterogeneous>(
88+
new (gc) typename std::conditional<std::is_same<Bound, Top>::value, Top, binder<Bound>>::type(
89+
std::forward<decltype(xs)>(xs)...));
9590
}
9691

9792
template <typename U>
@@ -143,13 +138,12 @@ inline namespace kernel
143138
{
144139
return *this ? get()->type() : typeid(null);
145140
}
146-
};
147141

148-
template <template <typename...> typename Pointer, typename Top>
149-
auto operator <<(std::ostream & os, heterogeneous<Pointer, Top> const& datum) -> std::ostream &
150-
{
151-
return datum.template is<null>() ? os << magenta("()") : datum->write(os);
152-
}
142+
friend auto operator <<(std::ostream & os, heterogeneous const& datum) -> std::ostream &
143+
{
144+
return datum.template is<null>() ? os << magenta("()") : datum->write(os);
145+
}
146+
};
153147
} // namespace kernel
154148
} // namespace meevax
155149

include/meevax/kernel/object.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ inline namespace kernel
2626
template <typename T>
2727
struct top
2828
{
29-
virtual auto type() const noexcept -> std::type_info const&
30-
{
31-
return typeid(T);
32-
}
33-
3429
virtual auto compare(heterogeneous<gc_pointer, T> const& x) const -> bool
3530
{
3631
if constexpr (is_equality_comparable<T>::value)
@@ -50,9 +45,14 @@ inline namespace kernel
5045
}
5146
}
5247

48+
virtual auto type() const noexcept -> std::type_info const&
49+
{
50+
return typeid(T);
51+
}
52+
5353
virtual auto write(std::ostream & os) const -> std::ostream &
5454
{
55-
return delay<iostream::write>().yield<std::ostream &>(os, static_cast<T const&>(*this));
55+
return os << static_cast<T const&>(*this);
5656
}
5757
};
5858

include/meevax/kernel/overview.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <meevax/memory/gc_pointer.hpp>
2121
#include <meevax/type_traits/requires.hpp>
22+
#include <meevax/utility/demangle.hpp>
2223

2324
#define NIL /* nothing */
2425

include/meevax/type_traits/delay.hpp

-125
This file was deleted.

0 commit comments

Comments
 (0)