Comments (6)
Why this should be simplified?
from dcv.
Figure plot(S)(S slice, GGPlotD gg, string title = "") if(isSlice!S)
is arguably more readable than
Figure plot(SliceKind kind, size_t[] packs, Iterator) (Slice!(kind, packs, Iterator) slice, GGPlotD gg, string title = "")
- shorter
- doesn't leak Slice internals
- hides all the logic inside the existing isSlice
- if Slice ever changes, it won't affect this function signature.
from dcv.
The older style should be used. After your change the following code would not work for example:
import mir.ndslice;
const s = slice!double(2, 3);
auto foo(SliceKind kind, size_t[] packs, Iterator) (Slice!(kind, packs, Iterator) slice)
{
slice.popFront;
}
foo(s);
from dcv.
I agree that (S) is simpler. But a DIP that strip const
should be implemented first .
from dcv.
isSlice
has a confusing name, isX should always be bool-return.
how about:
// before:
template isSlice(T) {
static if (is(T : Slice!(kind, packs, Iterator), SliceKind kind, size_t[] packs, Iterator))
enum size_t[] isSlice = packs[];
else
enum size_t[] isSlice = null;
}
// after: rename isSlice to getSlicePacks (and update code using it) and define:
template isSlice(T) {
enum isSlice = is(T : Slice!(kind, packs, Iterator), SliceKind kind, size_t[] packs, Iterator));
}
would that be acceptable? at least as PR?
from dcv.
isSlice
behaves as boolean if it is used as boolean. It just stores additional information that is very useful for generic code
from dcv.
Related Issues (20)
- betterC mir-cv HOT 6
- use documentation unittests to guarantee docs stays in sync with code and compiles (http://dcv.dlang.io/) HOT 3
- can we make glfwInit optional? HOT 16
- cannot use dcv dependency in a dub.json, http://code.dlang.org/packages/dcv.json broken
- undefined error when calling dcv.imgproc.convolution.conv HOT 7
- wrappers for opencv HOT 16
- git history not very linear; why not use `git pull --rebase`instead of `git pull`? HOT 1
- Create CONTRIBUTING file
- plotting without X-server HOT 1
- (most) bool return functions should instead throw on error
- Video IO Example HOT 12
- Error: function ffmpeg.libavformat.avformat.AVIndexEntry.flags(int v) cannot be overloaded with another extern(C) HOT 2
- Error: recursive alias declaration (using dmd git master) HOT 3
- core/utils.d(72,23): Error: cannot implicitly convert expression iota([shape[0]]) HOT 2
- update to mir-algorithm v0.9.1 HOT 1
- dcv/source/dcv/io/video/input.d(149,38): Deprecation: function `ffmpeg.libavcodec.avcodec.avpicture_get_size` is deprecated
- Broken example on the homepage? HOT 4
- is this library dead? HOT 7
- ImageFormat dependency has issues with some jpg?? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dcv.