Skip to content

Fix callback style#158

Merged
terurou merged 1 commit intoHaxeFoundation:masterfrom
DenkiYagi:fix-stream-callback
Dec 30, 2019
Merged

Fix callback style#158
terurou merged 1 commit intoHaxeFoundation:masterfrom
DenkiYagi:fix-stream-callback

Conversation

@terurou
Copy link
Member

@terurou terurou commented Dec 30, 2019

No description provided.

@terurou terurou merged commit 7818832 into HaxeFoundation:master Dec 30, 2019
@terurou terurou deleted the fix-stream-callback branch December 30, 2019 03:58
@Gama11
Copy link
Member

Gama11 commented Dec 30, 2019

What does this fix? Are these arguments just nullable rather than optional?

@terurou
Copy link
Member Author

terurou commented Dec 30, 2019

These arguments are Node.js style callback (a.k.a. nodeback). The other modules aren't written by optional argument style.
And I’d like to fix all callback arguments to use Null<Error> -> ... -> Void.

@Gama11
Copy link
Member

Gama11 commented Dec 30, 2019

The other modules aren't written by optional argument style.

So this is just meant as a code style consistency fix?

@terurou
Copy link
Member Author

terurou commented Dec 31, 2019

So this is just meant as a code style consistency fix?

Yes

@Gama11
Copy link
Member

Gama11 commented Dec 31, 2019

Well, the thing is, these don't mean the same thing. Without ?, the argument isn't optional.

class Main {
	static function main() {
		var f1:Null<Int>->Void = i -> trace(i);
		var f2:?Int->Void = (?i) -> trace(i);

		f1(0); // 0
		f2(0); // 0

		f1(); // Not enough arguments, expected :Null<Int>
		f2(); // null
	}
}

@terurou
Copy link
Member Author

terurou commented Dec 31, 2019

Without ?, the argument isn't optional.

I know that.

These callbacks are called by Node.js side and aren't called Haxe side directly.

@Gama11
Copy link
Member

Gama11 commented Dec 31, 2019

I guess it may just be a terminology thing, if something changes the behavior it's not a "code style fix" to me. Anyway, I don't think this really affects much. :)

terurou added a commit to DenkiYagi/hxnodejs that referenced this pull request Jan 14, 2026
* Update Module to v12 (HaxeFoundation#156)

* update

* Change to Dynamic

* Fix Module

* Fix Require

Co-authored-by: ahu <ahuglajbclajep@gmail.com>

* Update Assert to v12 (HaxeFoundation#157)

* update assert extern

* update comments

* change to string|error from string

* fixed miss

* update typedef types comments

* update comment

* Review

* update assert extern

* update assert extern

* update assert extern

* Review feedback

* Fix indent
* Fix typing
* Add strict-mode

* Revert Promise<Dynamic>

* add Assert strict mode

* Fix strict assert

Co-authored-by: 秋津 早苗 <akitsu-sanae@users.noreply.github.com>
Co-authored-by: takashiski <takashiskibb@gmail.com>

* Fix callback style (HaxeFoundation#158)

* Server#close callback will give an error (HaxeFoundation#154)

* Server#close callback will give an error

* Use imported Error

* Fix a TYPO

* Enable sortImports on save

* Update copyright headers to 2020

* Fix untyped __js__ deprecation warnings with Haxe 4.1.0 nightlies

* Haxelib release 12.0.0

* add missing methods which are causing issues in haxe.zip.Reader

* add @nadako's Uncompress code

* change final to var for haxe 3 compatibility

* Include hxnodejs.png in Haxelib releases

* Suppress some deprecated warnings. (HaxeFoundation#155)

Co-authored-by: akitsu-sanae <akitsu.sanae@gmail.com>

* Add version & license readme badge

Use badgen.net as universal badge provider.

* Add downloads badge

* LICENSE -> LICENSE.md

* Add the `File.append()` method. (HaxeFoundation#166)

Fixes HaxeFoundation#120.

* Haxelib release 12.1.0

* Fix invalid file path in Release.hx

* Add options to the `Fs.rmdir/rmdirSync` functions (HaxeFoundation#167)

* Make static the instance methods of module `js.node.Os`, fixes HaxeFoundation#168 (HaxeFoundation#169)

* Fix Https.get() / request() calls without options, closes HaxeFoundation#170

* add size to the datagram socket "message" remote info

* add missing ppid, release and report to Process

* use right type (Err => Error)

* Fix `sys.FileSystem.absolutePath` (HaxeFoundation#182)

Previously, on Linux, `absolutePath("C:\\file")` would simply add
`C:\file` to the current working directory. This was inconsistent with
other Haxe targets. Now, it simply returns `C:\file`.

* Implement `sys.io.File.update()` method (HaxeFoundation#180)

* Fix behaviour of FileInput.eof() (HaxeFoundation#181)

* Fix behaviour of FileInput.eof()

Used the c# implementation for reference, now it passes the sys tests
in the compiler repository

* Remove trailing underscores

* Add null case to `Sys.putEnv()` (HaxeFoundation#179)

* Add slash to `Sys.getCwd()` like other sys targets (HaxeFoundation#183)

* writeReport returns string

* individual fields of Release are optional

* fix optional fields

* Change deprecated '@:enum abstract' to 'enum abstract' to get rid of warnings (HaxeFoundation#190)

Co-authored-by: Kalle Kromann <Kalle.Kromann@laerdal.com>

* Haxelib release 12.2.0

* 本家由来の新モジュールに jsImport 対応を適用

* fix: enum abstract は @:js.import の対象にできないため class に変更

---------

Co-authored-by: terurou <terurou@denkiyagi.jp>
Co-authored-by: ahu <ahuglajbclajep@gmail.com>
Co-authored-by: 秋津 早苗 <akitsu-sanae@users.noreply.github.com>
Co-authored-by: takashiski <takashiskibb@gmail.com>
Co-authored-by: Kevin Leung <kevinresol@users.noreply.github.com>
Co-authored-by: Jens Fischer <jensfischer95@gmail.com>
Co-authored-by: P.J.Shand <pete@peteshand.net>
Co-authored-by: Dan Korostelev <nadako@gmail.com>
Co-authored-by: akitsu-sanae <akitsu.sanae@gmail.com>
Co-authored-by: Dario Vladovic <d.vladimyr@gmail.com>
Co-authored-by: Cédric Belin <cedric@belin.io>
Co-authored-by: lublak <44057030+lublak@users.noreply.github.com>
Co-authored-by: tobil4sk <tobil4sk@outlook.com>
Co-authored-by: k <k@klabz.org>
Co-authored-by: Kalle Kromann <kallekro@gmail.com>
Co-authored-by: Kalle Kromann <Kalle.Kromann@laerdal.com>
Co-authored-by: FAL <contact@fal-works.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants