Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ServerOptions] convert to Integers when not set to default values #4110

Merged
merged 7 commits into from
Jan 6, 2019

Conversation

patrickdupuis
Copy link
Contributor

@patrickdupuis patrickdupuis commented Oct 4, 2018

Purpose and Motivation

This PR fixes ServerOptions.asOptionsString by making it check its variables for indenticality(?) rather than equality. Now that Floats in SC contain at least one decimal number, it's not longer valid in some place to provide a Float where an Integer is expected. For example, we can't use 2.pow(16) to set the server's memSize because it returns 65536.0 rather than 65536[1]. Also, since 1.0 == 1, it isn't sufficient for .asOptionsString to test for equality when checking its variables against their default integer values. When false, I decided to cast the variables as Integers and reassign them to themselves. The reassignment part is debatable, I suppose.This PR only modifies server option variables that are powers of 2.

This PR also fixes a few default values and simplifies the check for useSystemClock. I purposefully avoided maxLogins because there's some strangeness there that I don't quite understand.

Update: As per @brianlheim's suggestion, I've removed all the magic numbers from asOptionsString and replaced them with references to values stored inside a classvar IdentityDictoinary, defaultValues. Due to an order of initialization error, I had to add a call to Class.initClassTree(ServerOptions) inside Score.initClass.

[1] supernova fails to boot, scsynth will not. The latter is an issue for another PR.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • All previous tests are passing
  • Tests were updated or created to address changes in this PR, and tests are passing
  • Updated documentation, if necessary
  • This PR is ready for review

Remaining Work

Copy link
Contributor

@mossheim mossheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSFT Beta features. hm

SCClassLibrary/Common/Control/Server.sc Outdated Show resolved Hide resolved
SCClassLibrary/Common/Control/Server.sc Outdated Show resolved Hide resolved
SCClassLibrary/Common/Control/Server.sc Outdated Show resolved Hide resolved
@patrickdupuis
Copy link
Contributor Author

I believe this is ready for another look @telephon @brianlheim :)

@patrickdupuis patrickdupuis added this to the 3.10.1 milestone Nov 16, 2018
SCClassLibrary/Common/Control/Score.sc Show resolved Hide resolved
HelpSource/Classes/ServerOptions.schelp Outdated Show resolved Hide resolved
@patrickdupuis
Copy link
Contributor Author

I gave this another careful look over to spot any typos. @snappizz you can merge when you get the chance.

@mossheim
Copy link
Contributor

@snappizz would you like to take a look at this? if not i think it's ready to merge

@mossheim mossheim merged commit 34c4486 into supercollider:3.10 Jan 6, 2019
@patrickdupuis patrickdupuis deleted the topic/memSizeFloat branch March 1, 2020 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants