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

Use & when passing function references to HashTable constructor #1728

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

valpackett
Copy link

ldc 1.16.0 complains about trying to call g_str_hash / g_str_equal with no arguments

@@ -285,7 +285,7 @@ private:

HashTable createHashTable() {
import gtkc.glib;
return new HashTable(g_str_hash, g_str_equal);
return new HashTable(&g_str_hash, &g_str_equal);
Copy link

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

ref is a keyword in function signatures, not in calls??

Copy link

Choose a reason for hiding this comment

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

Yes, if you need this then do it in the function call. I assume this error will propagate to other calls, right? Or is it context specific? If then then this is fine.

Copy link
Author

Choose a reason for hiding this comment

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

HashTable is obviously not a Tilix type, the constructor we're calling here is GtkD's wrapper around g_hash_table_new, we're giving it pointers to C functions (which g_str_hash and _equal are)

Copy link

Choose a reason for hiding this comment

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

So it seems this is the correct approach, I wish GtkD would provide more type safety.

ldc 1.16.0 complains about trying to call `g_str_hash` / `g_str_equal` with no arguments
/usr/local/include/d/object.d(3219,36): Error: cannot implicitly convert expression aa of type shared(ProcessStatus[int]) to const(shared(ProcessStatus)[int])
../source/gx/tilix/terminal/monitor.d(46,46): Error: template instance object.values!(shared(ProcessStatus[int]), shared(ProcessStatus), int) error instantiating
@valpackett
Copy link
Author

Added patch for another problem with newer ldc (1.18.0):

/usr/local/include/d/object.d(3219,36): Error: cannot implicitly convert expression aa of type shared(ProcessStatus[int]) to const(shared(ProcessStatus)[int])
../source/gx/tilix/terminal/monitor.d(46,46): Error: template instance object.values!(shared(ProcessStatus[int]), shared(ProcessStatus), int) error instantiating

@ximion ximion force-pushed the master branch 6 times, most recently from b53c46c to 2f9d050 Compare January 18, 2021 21:50
@ximion
Copy link
Collaborator

ximion commented Jan 18, 2021

From what it looks like, LDC builds Tilix just fine today, so I think GtkD added the necessary ref's to make this work.
However, the shared adjustment still seems relevant... If you have the time, could you please check if this is still needed and adjust the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants