T
tonytech08
In what way? Early C++ libraries (NIHCL) tried it, and found
that it didn't work. Java tried it, and found that it didn't
work.
Whoa! I was not talking about library-level!
In what way? Early C++ libraries (NIHCL) tried it, and found
that it didn't work. Java tried it, and found that it didn't
work.
That's bureaucratic
Judicious, in the way he seems to be using it, means "I'm too
stupid or too lazy to try to understand how it works".
Certainly, some people do overuse templates, but it's far from
universal.
There's also the question: what is overuse?
Of course, with the usual meaning of the word "judicious" in
English, his statement is trivially true. Everything should be
used "judiciously" (i.e. with good judgement).
Good luck on that one. Colleges don't get into the advanced, or in many
cases even the intermediate stuff. People just don't seem interested in
instructing themselves on these things either. I pushed pretty hard to
get reading and instruction material at my workplace.
I'm the only one who reads the stuff.
The only exception is when someone needs to know
something and I just refer them to the book that would help them.
NOP is the only instruction you have ALMOST everywhere.Ian said:Those "assembly language people" are telling your porkies. Such a
subset would be very small. "jmp" springs to mind.
Arrays? If you view an "array" as a container of objects, then a
template makes obvious sense.
If though, you view an "array" as a contiguous block of memory
(C++ remains close to the hardware"), then array as a template
is unappropriate.
(Did I grok your implied thought correctly?)
Almost.
Pointers: ok.
Structs implemented as templates? How?
Pete said:How? Patents are public disclosures of techniques. They in no way
prevent discussion of those techniques (indeed, their purpose is to
promote discussion and knowledge). What they prevent is use of those
techniques without permission.
I think I don't understand how IP law works in this regard.
Does this work the same way for code that it does for, say, an
apple peeler?
If someone invents a new apple peeler can I, at least in the
US, in aid of showing how the invention works, publish blue
prints, and maybe even make a virtual model in some simulation
software that emulates the apple peeling process to show how
truly good this type of apple peeler is?
If I can do that with a patented apple peeler, can I do that
with patented software?
Can I write code that shows how it is used? Distribute it on
paper? Distribute it on computer readable media? Write a
computer emulator that simulates the patented software, like I
could with the apple peeler?
And if I can do this, could there be a violation of, something
that I don't think exists for the peeler, a software
copyright?
Whoa! I was not talking about library-level!
James said:You can't patent "code". What you patent is an invention: a
process or a machine which is new and non-evident. And the
patent doesn't cover the "expression" of the invention, only the
invention itself. Also, you can't patent laws of nature or
algorithms (but you can patent particular applications of them).
At least traditionally, and in international law. I get the
feeling that the US is extending what patents were designed for.
There is no mention of the requirement to publish at
http://www.uspto.gov/web/offices/pac/doc/general/index.html#patent,
for example.
In order to patent an apple peeler, you *must* make the plans,
showing how it works, public. Otherwise, no patent.
Software is the expression of an algorithm. As such, it isn't
patentable, at least under international law.
The literal
expression can be copyrighted, of course, and the software may
be an integral part of a machine or process, which can be
patented. In that case, you do have to publish detailed
specifications of the machine or process, including detailed
specifications of what the code does,
and (generally, I would
assume) the algorithms it uses to do it. I don't think you'd be
required to publis a particular "expression" of those
algorithms, i.e. you need an English language expression of
them, but no C++ code.
Different jurisdictions interpret this differently; in the
United States, there is a patent for a "Cryptographic
communications system and method" which uses the RSA algorithm;
in the rest of the world, the absence of any physical machine in
the patent meant that it wasn't patentable, and the patent is
only valid in the US. But even under the US law, the authors of
the patent were required to publish the algorithm, in enough
detail that any moderately competent programmer could understand
it.
Copyright covers a different aspect: expression. The blueprints
of the apple peeler could be copyrighted. The patent office
requires, however, that a copy (or several) of them be filed
with the patent, and anyone can consult them. And you can
legally draw up your own blueprints, based on what you learned
by consulting them (but not copying), and publish them. If your
publication was just of the blueprints, I suspect that you'd
have a hard time introducing enough originality in them that
they wouldn't be considered a derived work. But if you were
writing a book on the history of apple peelers, you could
certainly include the blueprints, or parts of them, under the
fair use doctrine.
I think I see what you mean. Like this invention?
6,058,376
Process for evaluating the financial consequences of converting a
standard form I.R.A. to the Roth form I.R.A.
Maybe a little bit. Maybe a little bit too much. Maybe the
same way some C++ programmers misuse templates?
So much for our desire "To promote the progress of science and
useful arts".
.
For which I am grateful.
If you want a patent. If, it's just a trade secret that you
might be using to convict someone of a crime with, then I
don't think under the law of Florida, at least, that you have
to reveal your code. Well, maybe, we'll see how that
goes.http://www.heraldtribune.com/article/20080309/COMMUNITY/803090560
No, of course, not, but suppose I wanted to explain how the
patent about converting your IRA worked. Can I publish code
to explain it? On paper? On computer readable media? Just
the way I could for an apple peeler?
I mean, that patent says that it uses a computer. Maybe I
could implement a hardwired solution and that would be ok?
Could I hook the hardwired version up to a computer? Or what
about an "english" rendition of the algorithm?
I believe in the past that patents of this kind were required to publish
a circuit.http://www.softpanorama.org/History...etacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=%...
United States Patent 4,135,240
Ritchie January 16, 1979
Protection of data file contents
"The circuitry shown in the Figure controls file access in the following
manner..."
But it's not just math, I understand that thishttp://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=%...
patents not just properties of particular numbers, but an actual number
5,373,560 Partial modular reduction methodhttp://www.simson.net/clips/95.ScientificAmerican.PrimePat.txt
So what were you talking about?
NOP is the only instruction you have ALMOST everywhere.
Yes, and that's how the typed languages C and C++ see an array. In
that sense, a C array and a C++ tr1::array template models the same
concept. Only the syntax and rules governing conversions, ability to
assign/copy, etc. are different. And here the tr1::array template is
much more regular, thus simpler.
No, while it sounds like you are talking assembly language here, even
in assembly language types are involved (e.g. byte, word, double). So
the programmer has to consider the elements contained even in raw
memory for proper size calculation, element addressing and alignment.
The array concept encapsulates that very well, and a template is
perfect for modelling it. Without templates C had to use special
syntax and peculiar semantics for arrays (that are now commonly
described as "broken").
In principle:
typedef tuple <string, int> Person;
enum {name, age};
Person joe = make_tuple ("Joe", 33);
cout << get <age> (joe);
See Boost.Fusion and Assosiated Tuples for a thorough implementation
of this idea that has advantages such as introspection.
How?
An array can be a container of unsigned char objects. This is easily
achievable by a template as well, but irrelevant (see below).
Both boost::array and boost::shared_ptr are templates.
Something being a template does not mean that it prohibits being close to
hardware. More to the point, templates do not exist in the generated
code, only the template instantiations do, and they are technically the
same as non-templated functions or objects. As only the generated code is
exposed to hardware it is running on, the templates do not come into play
at all. Templates only live at the time of coding and compiling (with
"export", also linking stage). At run-time there are no templates, so
discussing their interaction with hardware is meaningless.
I don't believe it. Indeed, isn't, say, the Java VM basically an
abstraction of common machine instructions (or similar that works on
bytecode)?
Language/compiler supported dynamic typing just like in a wholly
dynamically typed language but applied only to implement generics. The
rest of the language would be statically typed (or at least at the
programmer's discretion). I was just wondering if that is easier to
implement than templates. Though now that I think about it again
today, what can be simpler than simply substituting text like is what
template implementations do basically (read, a more sophisticated and
built-into-the compiler preprocessor).
[...]
The array concept encapsulates that very well, and a template is
perfect for modelling it. Without templates C had to use special
syntax and peculiar semantics for arrays (that are now commonly
described as "broken").
I'm not convinced. I think we're just talking past each other
(different programming perspectives). The key to me is that "built-in
arrays" are contiguous and for an "array container", that is not
necessarilly so.
That is too far away from the machine to be at a traditional C/C++In principle:Structs implemented as templates? How?
typedef tuple <string, int> Person;
[...]
level if you ask me. It puts too much of a black box between me and
the hardware [...]
I think what you showed above is one of those things that
prompts me to "ask": "Are templates overused?".
I'm not convinced. I think we're just talking past each other
(different programming perspectives). The key to me is that "built-in
arrays" are contiguous and for an "array container", that is not
necessarilly so.
That is too far away from the machine to be at a traditional C/C++
level if you ask me. It puts too much of a black box between me and
the hardware (not the least of which a concern is being boiled in oil
by those megacorps that who have the resources to build complexity on
top of complexity until the little guy .. well get's slowly boiled in
oil). I think what you showed above is one of those things that
prompts me to "ask": "Are templates overused?".
[...]
The array concept encapsulates that very well, and a template is
perfect for modelling it. Without templates C had to use special
syntax and peculiar semantics for arrays (that are now commonly
described as "broken").I'm not convinced. I think we're just talking past each other
(different programming perspectives). The key to me is that "built-in
arrays" are contiguous and for an "array container", that is not
necessarilly so.
It is. Being contiguous is part of the array concept.
Both the C array and the tr1::array models this concept;
and equally
efficient in the sense of being "close to the hardware". The
tr1::array is just a cleaner model without the special syntax and
pecularities of the C array (non-copiable, decay, etc.).
That is too far away from the machine to be at a traditional C/C++Structs implemented as templates? How?
In principle:
typedef tuple <string, int> Person;
[...]
level if you ask me. It puts too much of a black box between me and
the hardware [...]
It is not really any further from the machine; you can view a tuple as
a structured layout of memory.
Vice verca, a 'struct' is just an
associative tuple indexed by names (fields). What I showed is that
templates has the power to model structs as well; just to answer your
question.
In this case I think you confuse "overused" with "used for complex
stuff". I don't think you'll find widespread use of associative
tuples. That said, I fully agree with you that keeping things simple
is a good rule of thumb. Again, judicious is good.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.