turion / rhine

Haskell Functional Reactive Programming framework with type-level clocks
http://hackage.haskell.org/package/rhine
124 stars 21 forks source link

Big renames #45

Closed turion closed 6 years ago

turion commented 6 years ago

Renames

renames we would like to have:

Renames we have to think about once more:

Won't rename

Aliases to add

ToDo

Consistency checks

Changes in other places (immediate)

Changes in other places (whenever they update to rhine-0.5)

ivanperez-keera commented 6 years ago

I'm not sure this belongs here, but should FRP.Rhine.ResamplingBuffer.KeepLast be called FRP.Rhine.ResamplingBuffer.ZeroOrderHold? That seems to be what it does if cl1 is discrete and cl2 is continuous.

turion commented 6 years ago

Yes, that sounds right.

turion commented 6 years ago

The step clock (where Step n produces ticks 0, n, 2*n etc. in the integer time domain) should have a better name. @ivanperez-keera any idea how that should be called properly? Something related to "logical clock" or so?

ivanperez-keera commented 6 years ago

Skip also sounds appropriate, doesn't it?

But, generally, yes, it seems somewhat related to clock sync, reference clocks and minor/major ticks.

I'll think about this.

EDIT: Changed phrasing not to assume something's better/worse.

turion commented 6 years ago

Should we maybe rename TimeDomainOf simply to TimeDomain? It would name clash with its assumed type class, which might be confusing, but this could be done with qualified imports.

ivanperez-keera commented 6 years ago

I don't see the name clash. Where is it?

turion commented 6 years ago

There is a type class called TimeDomain. I think you can't have a type class and a type (family) of the same name, right?

ivanperez-keera commented 6 years ago

When this happens to me, I usually add a suffix to the class. I suggest F or T for the type function, or C for the class.

Otherwise, and maybe I'm overcomplicating this (or the paper) but, to me, it seems like TimeDomain itself (the class) means something that can easily be expressed in more general (algebraic or category-theoretical) terms. If so, then maybe it would be best to name it something else?

We require that we can measure the difference between them? And what else? What do we assume about that difference?

turion commented 6 years ago
 When this happens to me, I usually add a suffix to one. You can
   use F or T for the type function, or C for the class.
I'm not sure I like that. I find TimeDomainOf still better than that
option.
 Otherwise, and maybe I'm overcomplicating this (or the paper),
   but, to me, it seems like TimeDomain itself (the class) means
   something that can easily be expressed in more general
   (algebraic or category-theoretical) terms. If so, then maybe it
   would be best to name it something else?
 We require that we can measure the difference between them? And
   what else? What do we assume about that difference?
It definitely can, and there has been a proposal by Alan Jeffrey,
deriving FRP from those axioms. There are some insights to be
learned. But it's not too clear to me and I don't want to do the
research right now.
ivanperez-keera commented 6 years ago

You should check what happened with this answer and that there is no confidential info leaked.

ivanperez-keera commented 6 years ago

When this happens to me, I usually add a suffix to one. You can use F or T for the type function, or C for the class.

I'm not sure I like that. I find TimeDomainOf still better than that option.

Sure. I don't think I've seen the use of 'Of' in type functions much, so it's a-typical, but that does not make it wrong. The reason why I opt for the other approach is that you can use it always. So, no ad-hoc decisions to be made for each case.

We can always revisit this when we know better.

EDIT: Better order of sentences.

turion commented 6 years ago

The freshly added CycleClock should maybe be called LogicalClock.

ivanperez-keera commented 6 years ago

Logical clocks are more general than a specific type-level step-based clock with a starting point, and they are an established concept in distributed systems.

Unless you are trying to claim that, for some reason, this is the way of implementing logical clocks in Rhine, which I would argue against, because I can think of others. And there are kinds/parts of logical clocks that this does not implement.

By the way, is it also possible to say something like '[1,3,..] in the type-level list? Because, if it is, the I guess it could be simpler (and also more general?).

ivanperez-keera commented 6 years ago

If implemented for general lists, I would call this ListClock. If implemented for a starting point and a delta, I would call these step clocks or fixed-step clocks (these are just my terms, nothing I've read in any literature).

turion commented 6 years ago

Right, logical clocks are something different from what I thought. ListClock is ok. There is already a StepClock n, it's basically CycleClock '[n] (see #50 ). Actually, how about calling CycleClock StepsClock? Then at least the relation between StepClock and StepsClock is clear.

turion commented 6 years ago

I can't get '[1,3,..] to work and I suspect that this can't work. Types can't be lazy or infinite.

ivanperez-keera commented 6 years ago

There is already a StepClock n, it's basically CycleClock '[n] (see #50 ).

I thought maybe that could be called SkipClock (because it skips steps, keeping one of n), or MacroClock (because it counts MacroTicks, in relation with a faster, global reference clock, which ticks with higher precision and counts MicroTicks).

Actually, how about calling CycleClock StepsClock? Then at least the relation between StepClock and StepsClock is clear.

I'd argue against it. The names are too similar. It will be confusing both in speech and in thinking.

ivanperez-keera commented 6 years ago

I can't get '[1,3,..] to work and I suspect that this can't work. Types can't be lazy or infinite.

Makes sense. Good to know.

turion commented 6 years ago

Won't rename KeepLast to ZeroOrderHold since the latter is usually used restrictively for digital-analog conversion. Instead, I'll add note in the docs/article.

turion commented 6 years ago

Also, I'll leave ResamplingBuffer's functions the same. The chance of name clash with State is so small, since ResamplingBuffer replaces its functionality.

turion commented 6 years ago

CycleClock should be called PeriodicClock. StepClock is an ok name, but maybe FixedStep is even better, as per your suggestion?

turion commented 6 years ago

On second thoughts, names shouldn't be too long. I'll add a note about fixed step length in the docs rather than changing the whole name.

ivanperez-keera commented 6 years ago

Which name is too long here?

turion commented 6 years ago

FixedStep. It's not very long, but still.

ivanperez-keera commented 6 years ago

FixedStep is absolutely perfect in length.

In general, and especially at the beginning, opting for longer names is better than opting for short names.

Longer names facilitate understanding, and the worst that can happen is that you'll need a search and replace, and an explanation in the paper/doc.

Shorter names make understanding harder. Search and replace is still possible, although it's generally harder to know what to replace it with because the name is not intuitively descriptive.

turion commented 6 years ago

Yes, actually you're right.